Visit Jeremy's Blog.
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 04-06-2004, 02:19 PM   #1
Registered: Apr 2002
Distribution: Ubuntu, Arch, freeBSD, Slackware
Posts: 210

Rep: Reputation: 30
shell script with dialog

I have this folowwing code:
dialog --title "Tunnel name" --backtitle "mod_gre tunneling script created by silviu" \
       --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.$$


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" ;;

rm -f /tmp/input.$$
i need to know where i do wrong, because the script is not giveing me anythig.

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
Old 04-06-2004, 04:01 PM   #2
Senior Member
Registered: Feb 2004
Location: Somerset, England
Distribution: Slackware 10.2, Slackware 10.0, Ubuntu 9.10
Posts: 1,938

Rep: Reputation: 55
In what way 'isn't giving me anything'? Not displaying the box, or not behaving as expected?
Old 04-07-2004, 01:47 AM   #3
Registered: Apr 2002
Distribution: Ubuntu, Arch, freeBSD, Slackware
Posts: 210

Original Poster
Rep: Reputation: 30
it's not behaving as aspected
it does not run this command:

ifconfig > /root/grepin |grep -n $na /root/grepin > /root/grepout |cat /root/grepout
Old 04-08-2004, 03:25 PM   #4
Registered: May 2003
Location: Kansas
Distribution: RH 9, OpenBSD, FreeBSD
Posts: 60

Rep: Reputation: 19
Try this:
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!)



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
Shell script inside shell script treotan Linux - General 4 02-19-2009 07:34 AM
Shell Scripting: Getting a pid and killing it via a shell script topcat Programming 15 10-28-2007 03:14 AM
Using Dialog in Shell Script kushalkoolwal Programming 30 06-04-2007 03:52 AM
shell script problem, want to use shell script auto update IP~! singying304 Programming 4 11-29-2005 06:32 PM
Making shell scripts interactive using dialog saurabh142857 Programming 2 01-03-2005 12:14 PM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 05:38 AM.

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