All Questions
261
questions
1
vote
2
answers
21k
views
export PATH permanently [duplicate]
I have exported the PATH but once I switch to a different terminal or reboot Debian, $PATH is reset. Here are the steps I take:
~$ vim scripts.sh
#!/bin/bash
echo "Hello"
I save it as mybash.sh and ...
3
votes
2
answers
7k
views
Setting environment variables with .bash_profile: only last export works properly
I am trying to export some environment variables in Unix using .bash_profile
It reads now like this:
export PATH=${PATH}:/usr/local/cuda-6.0/bin/
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/usr/local/...
3
votes
4
answers
19k
views
Fixing my PATH variable
When I type echo $PATH, I get the output:
/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games
However, I modified my PATH variable using gksudo gedit
/etc/environment; the file now reads PATH="/...
2
votes
4
answers
611
views
How can I find the program I'm hiding in bash
Say I have PATH="home/bob/bin:/usr/bin". I am writing a bash script /home/bob/bin/foo that will do some munging and then call /usr/bin/foo. Of course I want to be able to use this script on ...
1
vote
1
answer
385
views
Bash cannot see PATH update
I am running Debian on a VM. I login to the GUI and go to Applications > Accessories > Terminal.
# echo shell: /bin/bash
I modified ENV_SUPATH, ENV_PATH inside of /etc/login.defs. I restarted ...
3
votes
1
answer
777
views
How can I get $PATH to always include $(pwd)/sub_directory/.bin
If the path ~/dev/project1/node_modules/.bin/ionic exists, and my working directory is ~/dev/project1, I would like to be able to just type ionic and hit enter.
I could include all those ...
0
votes
2
answers
560
views
Different PATH formats for .bash_profile [duplicate]
There are few different formats I have seen so far:
With quotes and brackets:
PATH="/usr/local/bin:${PATH}"
With quotes only:
PATH="/usr/local/bin:$PATH"
None:
PATH=/usr/local/bin:$PATH
Export ...
0
votes
2
answers
191
views
Locate specific file from script
I've written a script file in which, one function searches for another script and if found, executes that script.
Script extract
#!/bin/bash
...
service_status() {
local my_script=`which my-services-...
1
vote
2
answers
998
views
Do programs source .bashrc when run?
I append to my PATH environment variable in my .bashrc file (Ubuntu v12). I also have a service (Atlassian Bamboo) that relies on the modifications to PATH. When I restart the service (which runs as ...
4
votes
1
answer
1k
views
let script find path of itself [duplicate]
I want to have a bash-script discover its own path.
The background is that I have a script called process_scanned_text.sh, which itself uses the script curves.
I put curves in the same directory as ...
15
votes
4
answers
146k
views
Basic commands not working i.e: -bash: ls: No such file or directory
I'm new to Unix and in the process of installing a program for my dissertation I must have played with the PATH for the basic Unix commands such as ls. Every time I type ls and the directory name I ...
2
votes
4
answers
5k
views
Make WGET available without path
I have ready bash script, which extensively uses wget command. Unfortunately wget is not available at standard path, but available at:
/usr/custom/bin/wget
I was able to make it usable w/o path in ...
16
votes
4
answers
54k
views
how to execute a bash script without typing ./ [duplicate]
It has been bugging me for a very long time and I'm really sick of it. For example there's a script called testscript that compares two directories. In class the prof can just type
testscript dir1 ...
4
votes
1
answer
950
views
Bash ignoring my PATH and it's cache
I have installed pip in my ~/.local/bin/ directory.
Here are the outputs of which, type and $PATH
$ type pip
pip is hashed (/home/bcc/pedros/.local/bin/pip)
$ which pip
/usr/bin/pip
$ echo $PATH
~/....
8
votes
4
answers
13k
views
Getting the current path in .desktop EXEC command
Im trying to make a .desktop file run a .sh which is stored in the same directory as the .desktop. The whole directory needs to be portable and moved from machine to machine.
my run script is run.sh
...
1
vote
0
answers
2k
views
-bash: android: command not found
I'm on a Mac running Mavericks trying to learn how to develop Android apps (in the process I'm learning bash too).
To run on the emulator they suggest the command android avd.
I always get the error ...
35
votes
2
answers
147k
views
Setting PATH vs. exporting PATH in ~/.bash_profile [duplicate]
What's the difference and which is better to use when customizing my bash profile? Documentation on the export command is scarce, as it's a builtin cmd.
Excerpt from version 1 of my ~/.bash_profile:
...
1
vote
2
answers
1k
views
Alias from .bash_profile is not reflected across the system
I have few path settings and alias in .bash_profile, and I am exporting those.
For example:
alias gcc=/abc/def/......./myrtgcc
export gcc
And I want use myrtgcc to compile C programs either from ...
1
vote
2
answers
589
views
remove files after insertion into tarball
I want to limit the number of files that get put into a tar ball and erease them after they've been inserted into the tarball and being indipendent from the current directory. I've tried this:
tar -C ~...
63
votes
9
answers
40k
views
List all binaries from $PATH
Is there a one-liner that will list all executables from $PATH in Bash?
4
votes
4
answers
14k
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
1
answer
1k
views
Program installed to `/home/username/bin` and added to path... not launching [duplicate]
I just installed newer versions of grep and vim to my local ~/bin directory.
I have the path added via PATH=$PATH:$HOME/bin in my .bash_profile.
When I try to run either, the version installed in /...
8
votes
2
answers
652
views
Default preference of executable over built-ins with the same name
I was playing around a bit with the names of some executables, putting them in a folder, ~/bin, which is in my $PATH. Now I'm wondering how I can set the preferences of a bash-3.2 terminal so that it ...
1
vote
2
answers
1k
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 with....
1
vote
1
answer
1k
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 ...
0
votes
1
answer
939
views
Full path name of bash? and base process of Linux?
I recently had the following questions:
What is the full path name of bash?
What is the base process of Linux?
I couldn't answer these.
1
vote
1
answer
1k
views
Unable to override the JAVA home in openSUSE 13.1
What I did: made an entry in both ~/.bash_profile and ~/.profile:
export JAVA_HOME=/usr/java/jdk1.7.0_51
export PATH=$PATH:/usr/java/jdk1.7.0_51/bin
Still the system points to some openJDK installed ...
1
vote
1
answer
20k
views
Meaning of `export PATH=…` in .bash_profile
I'm using a mac for some years now and as I'm currently learning ruby on rails, I felt like I should learn more about the system I'm using. I took a look at the ~/.bash_profile, it looks like this
...
0
votes
1
answer
3k
views
java add to the path
I have some .jar files in a directory, /home/unix/dfernand/bin/picard/picard-tools-1.106.
But when I add the directory to the PATH and CLASSPATH in my bashrc, java still does not recognize the .jar ...
3
votes
1
answer
1k
views
Getting sudo to work for an alias
I installed Sublime Text 3 in Fedora 20 which has got GNOME, as I couldn't get it being called from terminal I created a .bash_aliases file which a line like this:
alias sublime='sublime_text'
And ...
83
votes
18
answers
370k
views
Removing a directory from PATH
I'm trying to compile wxWidgets using MingW, and I have cygwin in my path, which seems to conflict. So I would like to remove /d/Programme/cygwin/bin from the PATH variable and I wonder if there is ...
4
votes
4
answers
6k
views
How can I force the use of a specific binary when running a script
How can I force a specific binary to be used when executing a bash script?
I have a bash script which uses the "php" binary.
There are several php versions on my computer. The main php binary, as ...
2
votes
1
answer
600
views
Debian Wheezy 7.1 - can't launch Skype or Firefox [duplicate]
I've installed Skype by using dkpg and when I try to run it, this is what I get -bash: /usr/bin/skype: No such file or directory. Which is very strange since ls -l | grep skype shows this:
-rwxr-xr-x ...
33
votes
2
answers
25k
views
Bash is not finding a program even though it's on my path
I have a program on my path. The program runs when executed with a full path specified. But the program cannot be found when I run it with just its name.
Essentially, I want to understand how the ...
11
votes
3
answers
18k
views
Why do 'ssh host echo $PATH' and printing the $PATH after ssh'ing into the machine give different results?
On a particular host, when I ssh into the machine and enter echo $PATH I get
/home/wxy/bin64:/home/wxy/bin:/usr/kerberos/bin:/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/bin:/usr/bin
and if I ...
3
votes
1
answer
1k
views
Find out where $PATH got corrupted
I'm using OSX Mountain Lion 10.8.2
$echo $PATH prints this:
/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/X11/bin:/Users/myusername/.rvm/bin
I've commented out everything in ~/.bash_profile and ...
7
votes
1
answer
1k
views
Correct handling of Python2 and Python3
What is the correct way running scripts that depend on python2.x but on a system where python3.x is aliased with python.
The solution should take into account the following things :
Python2 should ...
21
votes
3
answers
4k
views
Running an executable in PATH with the same name as an existing function
Sometimes I define a function that shadows an executable and tweaks its arguments or output. So the function has the same name as the executable, and I need a way how to run the executable from the ...
12
votes
4
answers
7k
views
List all files / binaries in current PATH
Is there an "easy" way of running an "ls -la" style command for listing all files / executable binaries in the current PATH?
(I intend to pipe the output into grep, for looking for commands with ...
8
votes
3
answers
10k
views
Added bin directory to my path, can't execute commands in it with 'sudo command'
I made a bin directory in my home folder where I place all my scripts. Then in my .bashrc I added the following:
export PATH=$PATH:/home/myusername/bin
So I could access files I placed in there from ...
7
votes
2
answers
907
views
Inhibit Variable Expansion in Paths
How do I prevent Zshell (and Bash I assume) from expanding environment variables in paths be completed as shown in the following example:
$PREFIX/alt/li
should expand to
$PREFIX/alt/lib
and not to ...
24
votes
3
answers
9k
views
My `which` command may be wrong (sometimes)?
I've compiled the last emacs version from the source code (v24.2) because the version installed on my machine is (quite) old for me (v21.3). I've done the usual:
$configure --prefix=$HOME
make
make ...
11
votes
3
answers
30k
views
Why Bash unable to find command even if $PATH is specified properly?
I am specifying path to my command in the file /etc/profile:
export PATH=$PATH:/usr/app/cpn/bin
My command is located in:
$ which ydisplay
/usr/app/cpn/bin/ydisplay
So, when I performing "echo $...
47
votes
5
answers
33k
views
How do I get rid of Cygwin's /cygdrive prefix in all paths?
I'm switching to Cygwin from the bash shell that ships with Git for Windows, and encountering a strange problem. Someone thought it would be a good idea to add /cygdrive/ to all paths, while I think ...
1
vote
2
answers
1k
views
How to find/correct error in a path
It's often that a long path is mistyped or you get a log file entry that a path does not exist. Is there a command or shell function that navigates the path hierarchy until it finds a matching path?
...
6
votes
3
answers
4k
views
Exporting just a single file
To make scripts accessible from anywhere in the terminal, one can use the following sequence of commands:
PATH=$PATH:some_path_here
export PATH
Which includes all files at the path sent in alongside ...
63
votes
20
answers
42k
views
Remove duplicate $PATH entries with awk command
I am trying to write a bash shell function that will allow me to remove duplicate copies of directories from my PATH environment variable.
I was told that it is possible to achieve this with a one ...
11
votes
4
answers
5k
views
How does Bash path completion work with sudo?
Tab path completion does not work (at least on Ubuntu and AFAIK Arch) with
sudo mount <whatever>
The iso file I am trying to mount is not in /etc/fstab. If I just type
mount <whatever>
...
3
votes
1
answer
5k
views
Why my $PATH is not inherited by the invoked bash?
I work on an AIX system where I have no administrator privileges. It has several shells installed, default being tcsh. I am not allowed to change the login shell. Usually I start my session from exec ...
1382
votes
12
answers
3.5m
views
How to correctly add a path to PATH?
I'm wondering where a new path has to be added to the PATH environment variable. I know this can be accomplished by editing .bashrc (for example), but it's not clear how to do this.
This way:
export ...