April 17th, 2011, 02:37 PM
Join Date: Jul 2004
Location: Middle Europa
Time spent in forums: 1 Week 1 Day 11 h 47 m 52 sec
Reputation Power: 12
- 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
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
working on Solaris[5-9], preferred languages french and C.