3
votes
6answers
166 views

Will $0 always include the path to the script?

I want to grep the current script so I can print out help and version information from the comments section at the top. I was thinking of something like this: grep '^#h ' -- "$0" | sed -e 's/#h //' ...
2
votes
4answers
383 views

Bash script to output path to USB flash memory stick

How would I return (output) the path to any USB flash memory stick(s) connected to the local computer using bash (Ubuntu and Linux Mint)? Background: I'm providing users with an automated backup ...
1
vote
2answers
54 views

How can I substitute one command for another temporarily?

I'd like to alias sed to gsed, but only while a particular script is running. I have a script that invokes sed. On the Mac, BSD sed doesn't support the required features, but I don't want to replace ...
1
vote
2answers
58 views

Make Trickle get the correct $PATH

Trickle is a bandwidth limiting program. I have the following script for trickle. #!/bin/bash echo $PATH trickle -s -t 3 -u 200 -d 200 "$@" I have a script in ~/bin/ that want to run the script ...
1
vote
1answer
71 views

Editing the .profile file to access

I am trying to source my .profile file to easily access a directory of javatools. The bash code below seems like it should work but it does not. Any help troubleshooting this script would be very much ...
5
votes
1answer
1k views

Global /etc/profile setenv or export overwriting user settings in .profile

I need to call a modified version of a program in /home/user_name/bin rather than the (older) version in /opt/program_name/current on a CentOS 5.3 cluster. The program creates a tcsh script using ...
1
vote
2answers
508 views

Checking if PATH contains $HOME/mydir and adding it if not (all in a script) [duplicate]

Possible Duplicate: keep duplicates out of $PATH on source I am not an expert with Unix scripting. Some of my scripts are located in $HOME/mydir. Unfortunately, they are not accessible from ...
6
votes
3answers
3k views

How to run a script from another path, and know the script's path?

I need to run a script that access a file in the same path it is located. For example: I have the script in /home/me/folder/script.sh, and this script will access the file /home/me/folder/myfile. As ...
13
votes
4answers
795 views

keep duplicates out of $PATH on source

I have the following code that's source-d by my .shellrc PATH="${PATH}:${HOME}/perl5/bin" PATH="${PATH}:${HOME}/.bin" export PATH but if I make changes to other code and then source this file, my ...