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:
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....
It's still not correct, the value of $? is 0 for match and 1 for no match after grep -c
The construct you are looking for is backticks.
Those are grave accents (ASCII 96), not regular straight apostrophes.
In other news, the parentheses around the ping in the if are superfluous, and the & you use in a few places means "background this process"; you want "&&" which means "and if the previous command was successful, also run ..." or perhaps just semicolon, which is basically equivalent to newline.
This assigns "bar" to the variable "foo" for the duration of the execution of the command echo boink
To assign a variable value which contains spaces, you want
There are differences between single and double quotes but in this context, both work equally well. I suspect it's better to save explaining the difference until another time.
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)
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)
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)
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)
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)
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)
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)