Siya Nxuseka
Siya Nxuseka

Reputation: 67

No such file or directory- Shell Script

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

Answers (1)

Ali Beyit
Ali Beyit

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

Related Questions