Did you know LQ has a Linux Hardware Compatibility List?
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 09-10-2004, 10:19 PM   #1
Registered: Nov 2002
Distribution: Slackware 8.1
Posts: 30

Rep: Reputation: 15
Question Shell script pipe input - bash mostly

I've been working on trying to create shell script that can accept piped data from another command.
example would be
ls -al | ./

echo "title = $title"
echo "data = $data"
echo -e -n "\033[7s"
tput cup 0 0
echo -n $title
echo -e -n "\033[8u"
echo -n $data

So, what it suppose to do is to print the title at location 0 0 of the screen and then list the file at the current location of the cursor. The output should look somehow like below:

[ My Program ]**********************************************

drwxr-xr-x 4 nobody nobody 376 Sep 11 09:59 .
drwxrwxrwx 27 root root 1664 Sep 10 21:48 ..
-rw------- 1 root root 12288 Sep 11 09:40
drwx------ 8 root root 672 Sep 10 22:25 audio.o5AxVk
-rwx--x--x 1 root root 1273 Sep 10 21:55
-rwx--x--x 1 root root 923 Sep 10 21:50
-rwxr-xr-x 1 root root 7881 Sep 10 23:07 leave
-rw------- 1 root root 691 Sep 10 23:07 leave.c
-rwx--x--x 1 root root 740 Sep 10 22:01
-rwxr-xr-x 1 root root 155 Sep 11 09:59
-rwx--x--x 1 root root 3301 Sep 10 21:58
Old 09-11-2004, 02:47 AM   #2
Senior Member
Registered: Jul 2004
Distribution: Slackware
Posts: 2,140

Rep: Reputation: 242Reputation: 242Reputation: 242
I don't know what you call $title and $data but try this :


while read data; do
    echo "data = $data"
ls -al | ./
1 members found this post helpful.
Old 09-11-2004, 01:55 PM   #3
LQ Guru
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 658Reputation: 658Reputation: 658Reputation: 658Reputation: 658Reputation: 658
Is this what you mean?

tput cup 0 0
echo "[ my program ] *************"
cat -
Old 09-12-2004, 01:10 AM   #4
Registered: Nov 2002
Distribution: Slackware 8.1
Posts: 30

Original Poster
Rep: Reputation: 15
Hi Cedrik,
You solution is exact solution I been looking for, jschiwal, thanks for the suggestion.
Old 11-09-2008, 06:14 PM   #5
LQ Newbie
Registered: Nov 2008
Posts: 1

Rep: Reputation: 0
Here is something I've done...

# buffer the input data

while read data; do
  ary=( "${ary[@]}" "$data" )


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
how can I take input with a shell script? GUIPenguin Linux - General 4 04-11-2005 04:46 PM
Shell script user input tuckermaddox Linux - Newbie 5 08-12-2004 04:14 AM
send automatic input to a script called by another script in bash programming jorgecab Programming 2 04-01-2004 01:20 AM
User input using a BASH script... causticmtl Programming 5 07-13-2003 10:59 PM
bash-script input aizkorri Programming 7 07-08-2003 07:15 AM

All times are GMT -5. The time now is 09:07 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration