LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
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.

Notices



Reply
 
Search this Thread
Old 04-06-2004, 02:19 PM   #1
sqn
Member
 
Registered: Apr 2002
Distribution: Ubuntu, Arch, freeBSD, Slackware
Posts: 210

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

Rep: Reputation: 54
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
sqn
Member
 
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:

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

Rep: Reputation: 19
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
 
  


Reply


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


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

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