Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

Running in Csh when using Tilde Notation performing a

~/ 

at the command line, I receive a "Permission denied." error. This directory is owned by the user performing the command and has the permissions.

myhostname% ~/
/my/home/dir/: Permission denied.

Checking the permissions:

myhostname% whoami
myuser
myhostname% cd ..
myhostname% pwd
/my/home
myhostname% ls -la 
total 40
drwxr-xr-x  7 myuser  mygroup 4096 Sep 16 10:49 .
drwxr-xr-x  3 root    root    4096 Sep 27 2010 ..
drwxr-xr-x 19 myuser  mygroup 4096 Jan 15 13:36 dir

I think I'm missing a setting somewhere in the .cshrc file but I'm not sure why or what is causing this. The reason I believe it's in that area is because when I exit back out into BASH I can perform the same operation (I guess this is sort of obvious since I'm switching profiles). Is there something glaringly obvious I'm missing?

myhostname% exit
logout
-bash-3.2$ ~/
-bash: /home/me/: is a directory
share|improve this question
    
Right! You aren't allowed to run your $HOME directory as a command, you know. –  vonbrand Jan 21 '13 at 20:28
    
Thanks, this may help other unix beginners! Switching shells frequently can be stressful. –  DogEatDog Jan 23 '13 at 17:51
add comment

2 Answers

up vote 4 down vote accepted

Directory cannot be executed even it has the executable permission. The executable permission means with the right permission user could access the directory and its content, such as reading files in the directory (still requires read permission for listing file).

share|improve this answer
    
Yes, Thank you. I now see why and the difference. –  DogEatDog Jan 15 '13 at 19:50
add comment

I think I found the answer:

~/ shouldn't run as command since it is a directory

~ = home directory

so I am are trying to run

/my/home/dir 

as a command, or rather

/my/home/dir/  

Ex:

myhostname% ~/
/my/home/dir/: Permission denied.
myhostname% ~
/my/home/dir: Permission denied.

Ultimately, I can still refer to files ~/myfile

share|improve this answer
2  
In zsh, or in bash ≥4.0, you can type a bare directory name and the shell interprets it as cd to that directory. (Requires setopt autocd/shopt -s autocd) –  Gilles Jan 15 '13 at 23:43
    
@Gilles : while bash zsh identify it as directory and print the error message or cd to it why csh prints this message which is not that relevant?? –  harish.venkat Jan 16 '13 at 4:12
    
@harish.venkat “Permission denied” is the error returned by the kernel. Bash and zsh make an additional check and display a different message if the file is a directory, csh doesn't. –  Gilles Jan 16 '13 at 10:28
    
@Gilles that's what my doubt is csh doesn't reply command not found its returning permission denied why?? –  harish.venkat Jan 16 '13 at 13:19
    
That makes so much more sense now when switching shells. I hate to admit it was my lack of experience with Csh and it throwing me a curve ball that spawned this issue. Thank you guys. –  DogEatDog Jan 17 '13 at 1:31
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.