I am no user of "tcsh" (and i actually suggest you switch to some standard shell - ksh or bash), but this can't be right:
Quote:
Originally Posted by tastybrownies
All shells work similar in a certain respect: variables are not used like in high-level languages but are simply expanded into the text they contain and then the resulting line is interpreted. For instance:
The syntax here is ksh, but it works the same: in the last line first "$command" is replaced with the content of the variable "command", then "$options" with the content of "options". The resulting line "ls -l" is then executed.
Your command adds a new line at the end of the file "~/.cshrc". The line is:
Now suppose "PATH" contains, say "abc" and think what will happen upon execution - it will result in a variable which contains a space character, because your line just says that. In fact your variable contains this space character:
Quote:
Originally Posted by tastybrownies
I echoed my path and this is what I saw:
To answer your question regarding colons: yes, you need them. In fact you need them instead of spaces, because space chars will break the functionality of the PATH variable. You need them between the paths, but not at the end or the beginning. Your statement should therefore probably be:
Notice the missing space char and the different placement of the colons.
Notice that "/usr/local/bin", "/bin" and some other paths exist several times. This should be corrected. I suggest instead of just adding lines to "~/.cshrc" you should change it with an editor. You probably have several lines in it which add to the PATH variable. Edit these and remove duplicates.
Another thing is including "." in the PATH. This is not a functionality but a security issue. Still it is often done out of laziness. I suggest you do NOT rely on it, because in the long run the drawbacks outweigh the gains.
I'm using Linux-Mandrake 8.0 in my laptop. After I logged in as a "root", I added a new path in my .bashrc file (I use bash shell). Then I can observe it has been set correctly by typing echo $PATH.
But, when I log in again as a personal account, not "root", then I open my bash shell, and type... (5 Replies)
If I the path to a directory, what command can I use to return the actual name of that directory.
test=`pwd`/folder1
> $test
folder1
I'd rather avoid anything with regular expressions. Any ideas? (1 Reply)
Hi,
I have a file abcd.txt which has contents in the form of full path file names i.e.
$home> vi abcd.txt
/a/b/c/r1.txt
/q/w/e/r2.txt
/z/x/c/r3.txt
Now I want to retrieve only the directory path name for each row
i.e
/a/b/c/
/q/w/e/
How to get the same through shell script?... (7 Replies)
If I enter (simplified):
find . -printf "%p\n"
then all files in the output are prepended by a "." like
./local/share/test23.log
How can achieve that
a.) the leading "./" is omitted
and/or
b.) the full path to the current directory is inserted (enclosed by brackets and a blank)... (1 Reply)
Hello,
I am on solaris 9 (KSH) and I am on trouble while using a command line in a script to get the directory size of a directory.
/usr/bin/du -sk /data/_restit
typeset -i rep_size=` /usr/bin/du -sk /data/_restit |cut -d"/" -f1 `
echo "${rep_size}"
I did try different way to write the... (6 Replies)
Guys,
I did a search on this but couldn't find any thing.
I need to add /home/scadm/scripts to the PATH. If I do the below it works for the session I'm in. If I close it and reopen it doesnt work.
PATH=$PATH\:/home/scadm/scripts ; export PATH
I also want this path added to all the... (3 Replies)
My input is as below :
/splunk/scrubbed/rebate/IFIND.REBTE.WROC.txt
/splunk/scrubbed/rebate/IFIND.REBTE.WROC.txt
/splunk/scrubbed/loyal/IFIND.HELLO.WROC.txt
/splunk/scrubbed/triumph/ifind.triumph.txt
From the above input I want to extract the file names only .
Basically I want to... (5 Replies)
I ssh in and am trying to add a directory permanently to $PATH in centos 7 and having issues. My current $PATH is
echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin
but when I do a sudo nano ~/.bashrc
# .bashrc
# User specific aliases and functions
alias... (7 Replies)
Hello,
I am creating a file with all the source folders included in my git branch, when i grep for the used source, i found source included as relative path instead of absolute path, how can convert relative path to absolute path without changing directory to that folder and using readlink -f ? ... (4 Replies)