Results 1 to 7 of 7
I write a shell script but now what i want to do is to use the test command and to be honest with you i really don't know, can someone ...
- 12-17-2008 #1Just Joined!
- Join Date
- Nov 2005
- Location
- UK
- Posts
- 19
shell and test command
I write a shell script but now what i want to do is to use the test command and to be honest with you i really don't know, can someone give me some advices and how to use it?
best regards dan,
- 12-18-2008 #2
if the man page is not clear, check this link out
Linux and me it's a love story
- 12-18-2008 #3Just Joined!
- Join Date
- Nov 2005
- Location
- UK
- Posts
- 19
ok, i seen that page, but what i don't know is how to test it where to add that script?
do i have to create another shell file or can be done inside the same file.
regards dan,
- 12-18-2008 #4
what do you want to test?
Linux and me it's a love story
- 12-18-2008 #5
While some more information would be useful, here is an example of test being used:
Here I am using the (far more common) [ ... ] alias for test. "-gt" is the test for integer greater-than, so this tests if the value in $var2 is greater than the value in $var1.Code:var1=5 var2=6 if [ "$var2" -gt "$var1" ]; then echo "var2 is greater than var1" fi
Does that help?DISTRO=Arch
Registered Linux User #388732
- 12-18-2008 #6Just Joined!
- Join Date
- Nov 2005
- Location
- UK
- Posts
- 19
hello there, yeah a bit does help, the thing is, i have a shell file and i have to test it with test command, this is a coursework from school and everything is working well until this test command thing, i just need to test it, nothing much, so the code which you supply me above was great but where to add it, do i need to create a new shell file and then run it? or i should stick this code in the same shell fine? this is where i am lost......
thanks for your help...
- 12-19-2008 #7
So as a general rule, homework questions are not allowed on the forum.
I still don't understand your problem, so I can't even tell you where to find more information. This construct is a basic conditional statement: it allows you to have different behaviour depending on the status of the program or some input that the user gave.DISTRO=Arch
Registered Linux User #388732


