Reputation: 67
Please review my script below am getting No such file or directory
error when executing it
Script.sh
_user="$(id -u -n)"
_uid="$(id -u)"
echo "User name : $_user"
echo "User name ID (UID) : $_uid"
REPOSITORIES= `/Users/$_user/workspace/work-folder/`
echo "$REPOSITORIES"
Output
$ ./user-name.sh
User name : 123456
User name ID (UID) : 8092
./user-name.sh: line 6: /Users/123456/workspace/work-folder/: No such file or directory
Can you please help, am still new to shell scripting.
Thanks in advance
Upvotes: 0
Views: 4064
Reputation: 414
REPOSITORIES="/Users/$_user/workspace/work-folder/"
Quotes makes difference, use double quotes when you are going to use variable in it. And also important, make sure you don't put space after and before equal sign as well.
Upvotes: 1