LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 11-23-2010, 12:45 AM   #1
EonSlack
LQ Newbie
 
Registered: Nov 2010
Posts: 15

Rep: Reputation: 0
Terminal script?


Using slackware 13.1 and customizing my Fluxbox menu...

Essentially i have two points, work and home, that i connect to the internet with so i have within my menu this code
Code:
[submenu] (connect to) {pick your poison...}
    [exec] (home) {iwconfig eth1 ESSID "home"}
    [exec] (work) {iwconfig eth1 ESSID "work"}
    [exec] (list!)
but sometimes i go on the road!
Essentially i want to make a command that will open a terminal and display available networks in the area if im not at home or at work...
but i dont know how to go about doing so, done some googling and found a code line that looked like something i wanted
Code:
gnome-terminal -x bash -c "ls; cat"
sadly i dont have gnome-terminal
So how would i execute this in rxvt? or another slack terminal.

(second thought here: I want to make it a condensed list, about 2-3 networks tops being displayed, what are the variables i would play with, within the opening of the terminal?_)
 
Old 11-23-2010, 01:41 AM   #2
Nylex
LQ Addict
 
Registered: Jul 2003
Location: London, UK
Distribution: Slackware
Posts: 7,464

Rep: Reputation: Disabled
Use the man page for whichever terminal you use to find the option to run a command. For xterm, it's the -e option. Really, though, why aren't you using Wicd?
 
Old 11-23-2010, 02:10 AM   #3
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
Quote:
Originally Posted by Nylex View Post
Really, though, why aren't you using Wicd?
+1 to that
 
Old 11-23-2010, 06:22 AM   #4
linus72
LQ Guru
 
Registered: Jan 2009
Location: Gordonsville-AKA Mayberry-Virginia
Distribution: Slack14.2/Many
Posts: 5,573

Rep: Reputation: 470Reputation: 470Reputation: 470Reputation: 470Reputation: 470
urxvt -e bash -c "ls; cat"
 
Old 11-23-2010, 06:40 AM   #5
coralfang
Member
 
Registered: Nov 2010
Location: Bristol, UK
Distribution: Slackware, FreeBSD
Posts: 836
Blog Entries: 3

Rep: Reputation: 297Reputation: 297Reputation: 297
You could always use `dialog', this is what i would do;
Code:
#!/bin/bash

# our network locations
NET1="home"
NET2="work"

# interface to use; pass as an argument
IFACE=$1

# temp file to hold selection number
TMPFILE=/tmp/netdialog.$$

# show menu with network locations and send stdout to a file
dialog --stdout --backtitle "Network Settings" \
  --radiolist "Select Location:" 10 30 2 \
        1 ${NET1} off \
        2 ${NET2} off > ${TMPFILE}

# read selection into a var
ITEM=$(<${TMPFILE})

# don't need this anymore
rm ${TMPFILE}

function connect {
        # run the command to connect
        /sbin/iwconfig ${IFACE} ESSID "$1";

        # check for last exit status, then display what happened
        [ $? != 0 ] && dialog --infobox "Error!" 3 15 || \
                       dialog --infobox "Success!" 3 15
}

# decide which option we selected
case ${ITEM} in
        1)
        connect ${NET1};;
        2)
        connect ${NET2};;
esac
Run it with your interface as an argument, "./blah.sh eth1" for example
It should show you a menu in your terminal to select a network/location and then pass it to `iwconfig' so you can connect.

I'm no bash expert by the way, so this could be utterly pointless... but hey it does work
 
  


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
[SOLVED] Terminal commands working in terminal but not in a script GreYFoXGTi Linux - Newbie 1 08-04-2010 09:36 AM
mysterious discrepancy b/w script results at terminal and in python script cedardoc Linux - Newbie 1 08-03-2010 03:59 PM
[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
Terminal And Script Help!! apb1987 Linux - Newbie 7 01-13-2009 05:59 PM
making a script that opens terminal and enter commands into that terminal Cinematography Linux - General 8 12-16-2008 10:34 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 09:11 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
Open Source Consulting | Domain Registration