Sponsored Content
Full Discussion: My first shot at variables
Top Forums Shell Programming and Scripting My first shot at variables Post 302233246 by arcnsparc on Saturday 6th of September 2008 09:51:37 PM
Old 09-06-2008
My first shot at variables

Okay, so im setting up a script to start my internet dependent scripts once I am connected to the net. It got complicated because of the different networks I frequent but it goes something like this:

Code:
n=1
iwconfig wlan0 > wireless.txt
m= grep -c MGHS /home/jake/Scripts/wireless.txt
o= grep -c NMU /home/jake/Scripts/wireless.txt
while [ $n -le 50 ]; do
    echo $n & sleep 3
    let n++
    if (ping -c 1 www.google.com)
        then sh /home/jake/Scripts/netdepsu.sh
    elif test "$m" -ne "0" 
        then sh /home/jake/Scripts/netdepsu.sh
    elif test $o -ne $0
        then sh /home/jake/Scripts/netdepsu.sh
    else echo "no internet"
    fi
done

Basically, if that txt file contains the name of one of the weird networks I use then I want to start up the other script (i cant ping at NMU or MGHS). Here are the two errors I just cant get rid of:

./looper.sh: line 13: test: : integer expression expected
./looper.sh: line 15: test: -ne: unary operator expected

if I dont have that space after those '='s up top then I get this error:

./looper.sh: line 6: -c: command not found
./looper.sh: line 7: -c: command not found

I know this has to be an easy fix if anyone could let me know I'd be ever so grateful....
 

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Print Multipul Fiels as One shot

Hi there This is my first post. I just want to know the best way to print N number of files as one shot. Let's simulate the case ... > ls file1.txt file2.txt file3.txt file4.txt file5.txt What is the best way to print all this files.. what I'm doing now is / > print... (9 Replies)
Discussion started by: geoquest
9 Replies

2. UNIX for Dummies Questions & Answers

unix screen shot

i would like to see an unix screen shot if anyone could take a screen shot of unix (7 Replies)
Discussion started by: royal
7 Replies

3. Shell Programming and Scripting

Delete all occurence of a word in one shot

i have a file called file1 cat file1 i am namish namish lives in India India and namish both are good. I want to delete all the occurences of namish in one shot,if i do it with sed i guess all the lines will be deleted containing the pattern.Suggest me any idea without AWK. Thanks... (6 Replies)
Discussion started by: namishtiwari
6 Replies

4. AIX

script which take a snap shot of Topas

can any one give me a script which take a snap shot of Topas at a fix interval of 15min and save it in a perticular file!!!!!!!! (6 Replies)
Discussion started by: abhishek27
6 Replies

5. Shell Programming and Scripting

remove a 350 files in one shot

i have a dir called logs. In it i have some 350 files how to move all those files from directory logs to a new dir called archive I want to do it in single shot Below the command i m trying but not getting find . -name "CurrentCollector*" -exec mv {} archive \;... (2 Replies)
Discussion started by: ali560045
2 Replies

6. OS X (Apple)

Please look at this screen shot: How do I remove this lock icon?!

RESOLVED in the screen shot I'd like to remove the lock sandwiched between the spaces indicator and the monitor icon, how do I get rid of it? It locks the screen and I cannot remember how it came to be http://guptaxpn.com/tmp/lock_icon_screenshot.png Thanks for your help! (3 Replies)
Discussion started by: guptaxpn
3 Replies

7. Shell Programming and Scripting

To change the ownership at one shot

i have a directory in which i have Multiple files: Following are they==== -rw-r--r-- 1 root root 886 Jan 21 16:38 trunkn.xsd -rw-r--r-- 1 root root 244 Jan 21 16:38 trunknameCache.xml -rw-r--r-- 1 root root 1240 Jan 21 16:38 subscribercache.xsd -rw-r--r-- 1 root ... (1 Reply)
Discussion started by: Aditya.Gurgaon
1 Replies

8. Shell Programming and Scripting

How to pass different number of arguments in a single shot

I have one configuration file. The number of lines in the file will vary. I need to pass each line as a parameter to a shell script in a single shot. Ex: Suppose file contains: ou=x,o=z o=y Suppose the shell script name is sample.sh. Then the script should be called like sample.sh ou=x.o=z... (6 Replies)
Discussion started by: saurabhkoar
6 Replies

9. Shell Programming and Scripting

How to execute multiple commands in one shot?

for example: I'm greping the process where i can get the location of the file $ ps -ef | grep LLAWP | awk {'print $9'} | tail -1 /Hostname/ihs/INSTANCE2/conf/WebAgent.conf then I need to display second line of WebAgent.conf file: $ cat /Hostname/ihs/INSTANCE1/conf/WebAgent.conf | head... (2 Replies)
Discussion started by: raghur77
2 Replies
WIRELESS(7)						     Linux Programmer's Manual						       WIRELESS(7)

NAME
wireless - Wireless Tools and Wireless Extensions SYNOPSIS
iwconfig iwpriv -a DESCRIPTION
The Wireless Extensions is an API allowing you manipulate Wireless LAN networking interfaces. It is composed of a variety of tools and configuration files. It is documented in more details in the Linux Wireless LAN Howto. The Wireless Tools are use to change configuration on the fly, to get statistics and diagnose those interfaces. They are described in their own man page (see below). Wireless configuration is specific to each Linux distribution. This man page will contain in the future the configuration procedure for a few common distributions (when I get the necessary info from them). For the time being, check the various files included with the Wireless Tools package. DEBIAN 3.0 Debian 3.0 (and later) has integrated wireless configuration in their network scripts. File : /etc/network/interfaces Form : wireless_<function> <value> wireless_essid Home wireless_mode ad_hoc See also : /etc/network/if-pre-up.d/wireless-tool /usr/share/doc/wireless.##/README.Debian ORIGINAL PCMCIA SCRIPTS
If you are using the original configuration scripts from the Pcmcia package, you can use this method. File : /etc/pcmcia/wireless.opts Form : *,*,*,*) ESSID="MY_ESSID" MODE="Managed" ;; See also : /etc/pcmcia/wireless File PCMCIA.txt part of Wireless Tools package AUTHOR
Jean Tourrilhes - jt@hpl.hp.com http://www.hpl.hp.com/personal/Jean_Tourrilhes/Linux/ SEE ALSO
iwconfig(8), iwlist(8), iwspy(8), iwpriv(8), iwevent(8). net-tools 12 July 2002 WIRELESS(7)
All times are GMT -4. The time now is 05:34 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy