Hi,
I have a script called sam.sh which consists of a single echo statement like this
#/usr/bin/ksh
echo "Mani"
I changed the mode for the script by giving chmod a+x sam.sh.
If I want to execute the scrpt by just giving the name at the command line "sam.sh", what should I necessarily do?... (3 Replies)
If I did indeed grep something out of it, why woudln't $result show nothing?
When I do $? , it does show success...
What is the proper syntax so that $result shows actual thing it's grepping out?
result=`(ssh $host tail -1 /something/somethingelse) | egrep -i "value" >dev/null`
#echo... (3 Replies)
Hi All,
I am new to shell scripting.
I have a variable which holds a numeric value.I have to check whether this variable holds a value between(0- 8),(8-17)(17-24).How do i write this syntax using if in shell scripting.
Thanks
Vignesh (2 Replies)
I would like to know:
1. How is `command` used?
2. How is '$command' used?
For example, a script file that checks for apache tomcat processes that I created has the following lines:
test
set suffix=` grep "6.0.18"`
set command = `ps -ef $suffix`
echo $command //?? hoping this... (2 Replies)
I'm new to shell scripting and would like to know what would be the best syntax to delete multiple directories in the same location? This is what I tried but it didn't work.
echo "clearing webtop and da cache."
su - $TOMCAT_USER -c rm -rf... (5 Replies)
Hey I have to create a unix script that when run uses the 'man' command to print out the command information of commands passed as arguments. I have the basic pseudo code, but I don't know how to implement a loop. Any help is greatly appreciated. Cheers.
short-manual <ls cc pwd>... (3 Replies)
Hi,
I am very new to this forum, can any one tell me which is the very basic certification on unix shell scripting?
please give me an advice on this. (1 Reply)
Hi All,
I am a newbie to shell scripting. I am trying to something like this.
#!bin/bash
cd /u01/app/oracle/
# then start the process
./opmnctl startall
Can someone help me with this requirement.
Help is very much appreciated.
Thanks
Venkat
Please use code tags next time for... (10 Replies)
Discussion started by: venkat8439
10 Replies
LEARN ABOUT ULTRIX
test
test(1) General Commands Manual test(1)Name
test - test conditional expression
Syntax
test expr
[ expr ]
Description
The command evaluates the expression expr. If the value of expr is true, the command returns a zero exit status; otherwise, it returns a
nonzero exit status. The command also returns a nonzero exit status if no arguments are specified.
Options
The following primitives are used to construct expr:
-r file Tests if the file exists and is readable.
-w file Tests if the file exists and is writable.
-f file Tests if the file exists and is not a directory.
-d file Tests if the file exists and is a directory.
-s file Tests if the file exists and has a size greater than zero.
-t [ fildes ] Tests if the open file, whose file descriptor number is fildes (1 by default), is associated with a terminal device.
-z s1 Tests if the length of string s1 is zero.
-n s1 Tests if the length of the string s1 is nonzero.
s1 = s2 Tests if the strings s1 and s2 are equal.
s1 != s2 Tests if the strings s1 and s2 are not equal.
s1 Tests if s1 is not the null string.
n1 -eq n2 Tests if number1 equals number2.
n1 -ge n2 Tests if number1 is greater than or equal to number2.
n1 -gt n2 Tests if number1 is greater than number2.
n1 -le n2 Tests if number1 is less than or equal to number2.
n1 -lt n2 Tests if number1 is less than number2.
n1 -ne n2 Tests if number1 is not equal to number2.
These primitives can be combined with the following operators:
!expr Negates evaluation of expression.
expr -a expr Tests logical and of two expressions.
expr -o expr Tests logical or of two expressions.
( expr... ) Groups expressions.
The -a operator takes precedence over the -o operator. Note that all the operators and flags are separate arguments to Note also that
parentheses are meaningful to the Shell and must be escaped.
See Alsofind(1), sh(1), test(1sh5)test(1)