I got a function to remove the directories from a path. but looks like this isnt quite working.. i am also not able to post the comments in the thread as it is closed.
So can anyone help me with this...
Last edited by satishkumar432; 05-30-2013 at 11:44 AM..
I am currently the below script in the link. I would like to have a functionality where the directories get
deleted from the $PATH variable of the system.
rmpath() #@ remove directory or directories from $PATH { #@ USAGE: rmpath dir ... for p in "$@" do p=${p%"${p##*[!/]}"} ## remove trailing slashes case $PATH in "$p":*) PATH=${PATH#$p:} ;; ## at beginning of PATH *:"$p") PATH=${PATH%:$p} ;; ## at end of PATH *:"$p":*) PATH=${PATH%":$p"*}${PATH##*"$p"} ;; esac done export PATH }
---------- Post updated at 09:55 AM ---------- Previous update was at 09:54 AM ----------
[QUOTE=satishkumar432;302814835]I am currently the below script in the link. I would like to have a functionality where the directories get
deleted from the $PATH variable of the system.
For a timely response...this works as expected... thank you very much.. as a novice to awk and sed i was not able to figure out .... A request.. could you explain.how you explored the sed options..if possible.. Thanks for your time..
Not sure what you mean by "explore the sed options". If you asked to explain: the sed script consists of three s(ubstitute) commands:
sed, in regexes, takes "^" for begin of line, and "$" for end of line.
HI Guys,
I am truing to add some directories to the productive HP-UX (like /usr/sbin)
the problem is that i tried some methods like (export) and setenv but i failed.
I add some logs output of the commands to provide you with more info .
the user which I am trying to add this path is different... (5 Replies)
Hi guys :)
First of all Happy New Year :)
so i dont know if my doubt its already here posted by other person ...
i need to print to one file the path of few files that are in different directories, like this:
directory muscle
ATP6.aa.muscle.fasta
COX1.aa.muscle.fasta
.
.
.
... (2 Replies)
Can anyone come up with a unix command that lists
all the files, directories and sub-directories in the current directory
except a folder called log.?
Thank you in advance. (7 Replies)
Hi I'm trying to select text between two lines, I'm using sed to to this, but I need to pass variables to it. For example
start="BEGIN /home/mavkoup/data"
end="END"
sed -n -e '/${start}/,/${end}/g' doesn't work. I've tried double quotes as well. I think there's a problem with the / in the... (4 Replies)
Hello Folks,
I want to append a path in user's PATH variable which should be available in current session.
Background
Numerous persons will run a utility.
Aim is to add the absolute path of the utility the first time it runs so that next runs have the PATH in env & users can directly run... (6 Replies)
Hi,
Could anyone help me in writing a single line code by either using (sed, awk, perl or whatever) to extract a specific path from the PATH environment variable?
for eg: suppose the PATH is being set as follows
PATH=/usr/bin/:/usr/local/bin:/bin:/usr/sbin:/usr/bin/java:/usr/bin/perl3.4
... (2 Replies)
Hi
I need a script which will remove a path from PATH environment variable. For example
$echo PATH
/usr/local/bin:/usr/bin:test/rmve:/usr/games
$echo rmv
test/rmve
Here I need a shell script which will remove rmv path (test/rmve) from PATH... (9 Replies)
Hi All,
My UNIX Version is:
OS Name Release Version
AIX appma538 3 5
I want to find certain files with some criterias under the given path. At the same time i want to find the files which resides under the given directory, but normal find traverse to its sub-directories... (4 Replies)
Hi,
Iam new to UNIX...My requirement is to create 3 dir as an hierarchy under /var/opt/temip.The output should be /var/opt/temip/GP_Int/GPTTS/AUTO.
I have tried the following script...But only GP_int folder is getting created and not other folders...Can someone help???
#!/usr/bin/ksh
#script... (1 Reply)
Hi ,
I have three funcions f1, f2 and f3 .
f1 calls f2 and f2 calls f3 .
I have a global variable "period" which i want to pass to f3 .
Can i pass the variable directly in the definition of f3 ?
Pls help .
sars (4 Replies)