Results 1 to 4 of 4
Friends,
I want to save some commands as aliases in the .bashrc so that I can execute them at my wish later. But after naming aliases for the commands, if ...
- 03-01-2009 #1Just Joined!
- Join Date
- Feb 2009
- Posts
- 15
~/.bashrc -- Permission Denied
Friends,
I want to save some commands as aliases in the .bashrc so that I can execute them at my wish later. But after naming aliases for the commands, if I say ~/.bashrc it says "bash : /root/.bashrc : permission denied" . I logged in as root.
What should I do?
- 03-01-2009 #2Just Joined!
- Join Date
- Feb 2009
- Posts
- 45
Answer:
Is the file executableč? If not, run
Originally Posted by Goutham_Linux
<EDIT time="2009-03-02T02:51:06.896142005+02:00" reason="correction">Code:$> chmod +x ~/.bashrc;
This is correct. I forgot to mention that your ~/.bashrc file actually needs to be a bash script (thereʼs a “#! /bin/bash” header in your script) for my suggestion to make sense.
Originally Posted by coopstah13
</EDIT>
Footnotes:
- In case it is not known how to detect this: Run
Then thereʼs a privilege mask leftmost. It is 10 characters long. If thereʼs no “x” in there, itʼs not executable. If thereʼs an “x” in there but the leftmost character in that mask is not “-” (minus), then itʼs not a regular file and you might need to follow the link (if the leftmost character is a “l”) or your config is simply screwed up (if itʼs neither “l” nor “-”).Code:$> ls -l ~/.bashrc;
An alternative of finding out is:
If its output is “1”, the file is executable, else itʼs not executable.Code:[ -x ~/.bashrc ]; echo $?
- 03-01-2009 #3
can you post the exact code you are trying to execute in terminal? ~/.bashrc is not a valid command, and it will give you that error
- 03-02-2009 #4Just Joined!
- Join Date
- Feb 2009
- Posts
- 45
Disregard that. What you are probably looking for is:
Code:$> man bash […] source filename [arguments] Read and execute commands from filename in the current shell environment and return the exit status of the last command executed from filename. If filename does not contain a slash, file names in PATH are used to find the directory containing filename. The file searched for in PATH need not be executable. When bash is not in posix mode, the current directory is searched if no file is found in PATH. If the sourcepath option to the shopt builtin command is turned off, the PATH is not searched. If any arguments are supplied, they become the positional parameters when filename is executed. Otherwise the positional parameters are unchanged. The return status is the status of the last command exited within the script (0 if no commands are executed), and false if filename is not found or cannot be read. […]


Reply With Quote
