As the title says, I am trying to determine if my bash script receives a full path or a relative file to a directory as a parameter.
For some reasons the following doesn't seem to work for me:
if [ "$DIR" = /* ]
./script.sh: line 5: [: too many arguments
[ ... ] doesn't do pattern matching.
/* is being expanded to the contents of
/, so effectively you have
if [ "$DIR" = /bin /boot /dev /etc /home /lib /media ... /usr /var ]
or something similar. Use
[[ ... ]] instead.
if [[ "$DIR" = /* ]]; then