|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Problem with script
Hello there
|
|
#2
|
|||
|
|||
|
Quote:
Hello, try this: : # Test the arguments number [ $# -eq 1 ] || { echo "$0: call: $0 string_to_search" >&2 exit 1 } # Test the argument against the file directory if grep $1 directory then echo there is a match else echo no such department found fi # Decide whether "grep -i" is not a better possibility I have tested it under AIX and under ksh. I would recommend to test in each script the total number of given arguments. It is done in the first part of my script. Then you can test argument number 1 only, but you can use your $* , too. The grep -i would ignore the case of the argument. Another possible construction of the if statement could be grep ... if [ $? -eq 0 ] then ..... else .... fi Have a fun! ![]() |
![]() |
| Viewing: Dev Shed Forums > Operating Systems > UNIX Help > Problem with script |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|