Problem with shell permissions

1 reply [Last post]
karinatherese
User offline. Last seen 4 years 41 weeks ago. Offline
Joined: 07/25/2013

Hi there :) I'm also a beginner in programming and I'm currently having problems executing the dir.sh described in p.91.
This is what I get after typing dir.sh in command line:

Karina-Thereses-MacBook-Pro:scripts karinatheresegulay$ dir.sh
-bash: dir.sh: command not found

I can execute the the script by typing ./dir.sh while I am in the ~/scripts folder but not in other locations.

Karina-Thereses-MacBook-Pro:scripts karinatheresegulay$ cd ~
Karina-Thereses-MacBook-Pro:~ karinatheresegulay$ ./dir.sh
-bash: ./dir.sh: No such file or directory
Karina-Thereses-MacBook-Pro:~ karinatheresegulay$ cd ~/scripts
Karina-Thereses-MacBook-Pro:scripts karinatheresegulay$ ./dir.sh
total 8
drwxr-xr-x 3 karinatheresegulay staff 102 Jul 25 15:43 .
drwxr-xr-x+ 28 karinatheresegulay staff 952 Jul 18 23:26 ..
-rwxr-xr-x@ 1 karinatheresegulay staff 109 Jul 25 18:15 dir.sh
Above are the directory listings for this folder:
/Users/karinatheresegulay/scripts
Right now it is:
Thu Jul 25 18:25:53 PHT 2013
Karina-Thereses-MacBook-Pro:scripts karinatheresegulay$

Here are other information from my terminal:

Karina-Thereses-MacBook-Pro:scripts karinatheresegulay$ echo $PATH
/Library/Frameworks/Python.framework/Versions/2.7/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:/usr/ebiotools/bin:/Users/karinatheresegulay/scripts≈
Karina-Thereses-MacBook-Pro:scripts karinatheresegulay$ cat ~/.bash_profile

# Setting PATH for Python 2.7
# The orginal version is saved in .bash_profile.pysave
PATH="/Library/Frameworks/Python.framework/Versions/2.7/bin:${PATH}"
export PATH="$PATH:$HOME/scripts"≈

Karina-Thereses-MacBook-Pro:scripts karinatheresegulay$ pwd
/Users/karinatheresegulay/scripts

Karina-Thereses-MacBook-Pro:scripts karinatheresegulay$ ls -la
total 8
drwxr-xr-x 3 karinatheresegulay staff 102 Jul 25 15:43 .
drwxr-xr-x+ 28 karinatheresegulay staff 952 Jul 18 23:26 ..
-rwxr-xr-x@ 1 karinatheresegulay staff 109 Jul 25 18:15 dir.sh

I hope you can help me troubleshoot this. I'm really new at this and I'm having a hard time pinpointing where I made a mistake.

By the way, I'm only using OS X 10.6.2

Thanks. :)

pcfb
User offline. Last seen 4 days 22 hours ago. Offline
Joined: 08/04/2010
Shell permissions

There is an equal sign at the end of the path definition that you show. Are those copy-paste artifacts or actually in your .bash_profile?

Two side notes:
You can make your prompt have a shorter name for your computer if you change its name in the Mac's Settings under the Sharing tab.

Also, using ./dir.sh works only in your scripts folder because the dot is a shortcut for the full (absolute) path of your current directory, just like tilde is a shortcut for the home directory. It is telling bash where to find the dir.sh file which it can't find in your path.