LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   shell script with dialog (https://www.linuxquestions.org/questions/programming-9/shell-script-with-dialog-166932/)

sqn 04-06-2004 01:19 PM

shell script with dialog
 
I have this folowwing code:
Code:

#!/bin/bash
dialog --title "Tunnel name" --backtitle "mod_gre tunneling script created by silviu -silviu@umbra.ro" \
      --inputbox "Enter the name of the tunnel \nplease use whole words, no spaces alowed\nand try to keep at most 8\
                characters" 8 60  > /tmp/input.$$

sel=$?

na=`cat /tmp/input.$$`
case $sel in
  0) ifconfig > /root/grepin |grep -n $na /root/grepin > /root/grepout |cat /root/grepout ;;
  1) echo "Cancel is Press" ;;
  255) echo "[ESCAPE] key pressed" ;;
esac

rm -f /tmp/input.$$

i need to know where i do wrong, because the script is not giveing me anythig.

Code:

ifconfig > /root/grepin |grep -n $na /root/grepin > /root/grepout |cat /root/grepout
this command is working perfectly but putit in this script doesn't work

thx in advance

Komakino 04-06-2004 03:01 PM

In what way 'isn't giving me anything'? Not displaying the box, or not behaving as expected?

sqn 04-07-2004 12:47 AM

it's not behaving as aspected
it does not run this command:

Code:

ifconfig > /root/grepin |grep -n $na /root/grepin > /root/grepout |cat /root/grepout

dford 04-08-2004 02:25 PM

Try this:
Code:

ifconfig | grep -n $na
Simpler. Let us know whether it works or not.

In your example you are redirecting stdout twice on two commands with the ">" and "|". I would expect your results to be undefined. (Anything could happen!)

Don


All times are GMT -5. The time now is 06:43 AM.