
April 17th, 2011, 02:37 PM
|
|
Contributing User
|
|
Join Date: Jul 2004
Location: Middle Europa
Posts: 1,200
  
Time spent in forums: 1 Week 1 Day 11 h 47 m 52 sec
Reputation Power: 12
|
|
hello all
- sure you know, file names are unique in A dir
so $1 and $2 have different path
that 'if' will always return 1
you must use 'basename $1'
- the 'if' statement for a string comp is not the best way, use 'case'
- that 'else' AFTER an 'exit' is really useless
- check for number of params
- also use different exit codes
- try something like
Code:
case $# in 2) ;; *) echo wrong # params; exit 1;; esac
case `basename $1` in `basename $2`)
echo $1 and $2 have the same basename; exit 0;; esac
echo $1 and $2 have different basename
exit 2
__________________
working on Solaris[5-9], preferred languages french and C.
|