LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
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 10-22-2011, 11:13 AM   #1
vankirk88
LQ Newbie
 
Registered: Oct 2011
Location: Georgia
Distribution: #!, Arch
Posts: 5

Rep: Reputation: Disabled
Question BASH script issue w/ popout terminal...


Hiya all, first post here so be gentle :P

I've been taking time to learn bash scripting and enjoying messing with my network so I figured I'd take the commands I use the most often and write up a bash script with them (airodump, aircrack, aireplay, dsniff, nmap, arpspoof, etc.)

Long story short i'm having a major issue with this arpspoof script that i'm trying to write and after tirelessly trying to find a answer, just can't seem to get it to work.

Code:
#!/bin/bash
clear
read -p "Run route -n? (y/n) " dgateway
    if [ dgateway = y ]; then
        sudo xterm -e "route -n" &
        echo "Moving along..."
    fi
....more code from here....
I've been trying to learn how to do this via several older books and just picking apart other peoples scripts. So most of the time i'm not even sure if the information still applies.

What happens for me is it briefly opens a window (can just see it flash) and moves along with the rest of the script. What I want to happen is it pop up a window and leave it be while the script moves along. Really got me annoyed, hehe.
Any help here would be greatly appreciated.
 
Old 10-22-2011, 11:22 AM   #2
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,578
Blog Entries: 31

Rep: Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208
One solution (not tested) is to start xterm with -e 'bash --rcfile <path/to/your/custom script>' with your custom script written to run the route -n command. This works because bash, unlike route -n, does not exit until the interactive user makes it.

Last edited by catkin; 10-22-2011 at 11:22 AM. Reason: typo
 
Old 10-22-2011, 11:44 AM   #3
grail
LQ Guru
 
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 10,007

Rep: Reputation: 3192Reputation: 3192Reputation: 3192Reputation: 3192Reputation: 3192Reputation: 3192Reputation: 3192Reputation: 3192Reputation: 3192Reputation: 3192Reputation: 3192
How about using the -hold option:
Quote:
-hold Turn on the hold resource, i.e., xterm will not immediately destroy its window when the shell command completes. It will wait until you use the window manager to destroy/kill the window, or if you use the menu entries that send a signal, e.g., HUP or KILL.
 
1 members found this post helpful.
Old 10-22-2011, 02:32 PM   #4
vankirk88
LQ Newbie
 
Registered: Oct 2011
Location: Georgia
Distribution: #!, Arch
Posts: 5

Original Poster
Rep: Reputation: Disabled
Thanks to both of you for your answers...Finally got it working the way I wanted with the -hold command, tried using it before but I think I had the syntax wrong.

Also, thats interesting catkin, gave me something to play around with...didn't quite follow, but I got the basic concept of what you were saying, should come in handy later.
 
  


Reply



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
Change terminal title with bash script. Amerika Ubuntu 3 10-19-2011 02:06 PM
Bash script works in terminal but not in cron. rivacom Linux - General 21 06-16-2011 10:22 AM
Referring to the Current Terminal in a Bash Script? Daedagnir Programming 4 12-24-2010 10:36 AM
[SOLVED] How to make a bash script keep running in same terminal after it calls second script? JohnRock Linux - Newbie 4 06-25-2010 09:16 AM
bash script to resize gnome terminal ? smoker Linux - General 1 03-17-2006 03:32 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 05:30 PM.

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
Open Source Consulting | Domain Registration