Shell script pipe input - bash mostly
Hi
I've been working on trying to create shell script that can accept piped data from another command.
example would be
ls -al | ./myscript.sh
#!/bin/bash
title=$1
data=$2
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 .clock.sh.swp
drwx------ 8 root root 672 Sep 10 22:25 audio.o5AxVk
-rwx--x--x 1 root root 1273 Sep 10 21:55 blink.sh
-rwx--x--x 1 root root 923 Sep 10 21:50 clock.sh
-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 math.sh
-rwxr-xr-x 1 root root 155 Sep 11 09:59 my.sh
-rwx--x--x 1 root root 3301 Sep 10 21:58 show.sh
|