Automator Shell Script  echo $PATH eval /usr/libexec/path_helper -s echo $PATH   Results:  after the first echo $PATH:  /usr/bin:/bin:/usr/sbin:/sbin   after the second echo $PATH:  /usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin   As ImageMagick is installed in /usr/local/bin it means that it fails unless I mess with the PATH first anyone know where Automator (Java is the same) gets its path from and how to permanently add the missing paths
122044
I'm making an Automator workflow that uses the shell script action to process a selection of images with the imagemagick composite command. Only I'm having issues getting it going. According to the results I get when I run the workflow, everything is working however, I know it's not due to the fact that the changes I'd expect to see in the folder of images are not present. I know that the imagemagick command I'm using is correct as it works correctly from the console. (I echoed the composite command to the output &amp; copied it into a Terminal session. Ran like a charm). BTW: The workflow's for processing a fade in on a stop motion movie I made. Yes I know I could use video tools to achieve the same thing, but the ones I have access to screw up the image quality on output.  Here's the script  imagesCount=$# rate=$(echo "scale=2; 100/$imagesCount"|bc) percentage=$rate for f in "$@"; do     fileName=${f%.*}     composite -blend "$percentage" -size 1280x720 "$f" xc:black -alpha Set "$fileName-1.jpg"     percentage=$(echo "scale=2; $percentage+$rate"|bc) done   At first I thought at the cause of the problem might be spaces in the paths, but I removed this possibility by shifting the files to a path without spaces, but that had no effect.  I'm almost certain the issue is related to something in the bash command but I don't know bash at all, this is my first time writing any bash command scripts, but I am very knowledgeable in Windows console scripting and would have no trouble getting this to work there.  If the error in the script isn't obvious enough to catch, would someone propose a method to debug this so I can figure out why the images are not getting processed even though the script runs without error?
94332
Say I have two paths: &lt;source_path&gt; and &lt;target_path&gt;. I would like my shell (zsh) to automatically find out if there is a way to represent &lt;target_path&gt; from &lt;source_path&gt; as a relative path. E.g. Let's assume  &lt;source_path&gt; is /foo/bar/something &lt;target_path&gt; is /foo/hello/world  The result would be ../../hello/world Why I need this: I need  like to create a symbolic link from &lt;source_path&gt; to &lt;target_path&gt; using a relative symbolic link whenever possible, since otherwise our samba server does not show the file properly when I access these files on the network from Windows (I am not the sys admin, and don't have control over this setting) Assuming that &lt;target_path&gt; and &lt;source_path&gt; are absolute paths, the following creates a symbolic link pointing to an absolute path. ln -s &lt;target_path&gt; &lt;source_path&gt;  so it does not work for my needs. I need to do this for hundreds of files, so I can't just manually fix it. Any shell built-ins that take care of this?
83889
I have an older version of Git installed at:  /usr/bin/   I recently downloaded a newer version to:  /usr/local/bin   When I type:  which git   I get the location of the old version. I believe that this is just because /usr/bin/ appears before /usr/local/bin in my $PATH variable and so the older version of git is 'found' first.   To test this, I renamed the older version of git to "git_old". Now when I type:  which git   I get the location of the newer version, as expected. But when I type:  git --version   I get the following error:  -bash: /usr/bin/git: No such file or directory   I'm just wondering why my computer is going back to looking in the old location for Git?
39177
For example, TeX Live Utility 1.17 and earlier will not work on Mac OS X 10.10 Yosemite. If a shell task relies on the PATH environment variable to launch a command, rather than a fully-specified path, it will likely fail. A typical error message will look like this:  /usr/texbin/updmap-sys: line 30: exec: updmap: not found   This can also occur in programs that launch pdflatex, dvipng, epstopdf, or other commands as part of a typesetting process.
91369
The way you would normally include a script is with "source"  eg:  main.sh:  #!/bin/bash  source incl.sh  echo "The main script"   incl.sh:  echo "The included script"   The output of executing "./main.sh" is:  The included script The main script   ... Now, if you attempt to execute that shell script from another location, it can't find the include unless it's in your path.  What's a good way to ensure that your script can find the include script, especially if for instance, the script needs to be portable?
65040
I accidentally unset all the directories of $PATH while trying to add a new one in ~/.bashrc. I opened a new terminal window as I was editing and now $PATH is empty. I'm worried if I boot from another drive to find the $PATH I won't be able to boot into this drive again.  Basically, what is the default result of echo $PATH?
121539
Here is my script:  #!/bin/bash  echo "Digite o local em que deseja instalar o IGRAFU(pressione enter para  instalar em  ${HOME}/IGRAFO):" read caminho if test -z $caminho then caminho="${HOME}/IGRAFO" fi echo "O IGRAFU será instalado no diretório: $caminho" mkdir -pv $caminho  mv -v ./* $caminho echo "Pronto!"   At 'read caminho' I may receive from the user a path like ~/somefolder. When the script receives that kind of path both mv and mkdir won't make tilde expansion, so it will try to create a ~/somefolder and not /home/username/somefolder and therefore fail.  How do I ensure that the tilde will be converted into the HOME variable?
40396
I tried to install anaconda on my Ubuntu VM (following ), but for some reason the installation skipped on adding anaconda to the PATH variable. I followed instructions  and it somewhat helped. Now I have to call:   export PATH=$PATH:/home/myname/anaconda3/bin   every time. It works (for example, if I want to import numpy) , but obviously not comfortable. how can I solve it so it will work from now?  this is the PATH variable -   PATH="$HOME/bin:$PATH:/home/name/anaconda3/bin"   and echo $PATH returns /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin  when I try to import I get -      &gt;&gt;&gt; import numpy Traceback (most recent call last):   File "&lt;stdin&gt;", line 1, in &lt;module&gt; ImportError: No module named 'numpy'   right now, calling echo $PATH in the in the window where i called source  gives  /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/home/ofirarzi/anaconda3/bin:/home/ofirarzi/anaconda3/bin  but in any other window I get   /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
55413
The question is pretty straight forward. I can get the exit code of the previous command by using $?. But what exactly is it?  I don't think it is a variable, because you can't have any special characters in the name of variable other than _.  foo?foo=10   will result in the error: foo?foo=10: command not found  So if it is not a variable, what is it? Are there others like it?
2907
Simple enough question: is there some shell command (or GUI method) I can use that, given the path to a file on my system, tells me what package put it there? Assuming the file did in fact come from a package, that is.  Bonus question: what if it's a file that isn't installed on my system? Is there, say, a website that will let me look up a file and see what packages, if any, provide it?
88572
Apps launched via Finder seem to not respect the PATH as set in .bash_profile.  So when I try to run code from an IDE (Intellij) I no longer have access to programs in /usr/local/bin, which is normally added to my path in the Terminal.  Apparently .MacOSX/environment.plist  to do this, but it no longer works in Lion.  How can I set the PATH for Finder-launched applications?
93581
I have no idea how to correctly define my graphics path on . In a Linux terminal my folder location would look like: \home\Libraries\Documents\paperimages  I'm sorry if this is asked on the usual, but I cannot find any real substantial help online.
27179
I was trying to add something to $PATH and it went totally wrong.  I now can't run any commands such as ls.  I've looked at this   and used the following lines:  PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin PATH=$PATH:~/bin   These lines fix the problem temorarily; however, when I restart terminal it seems to forget these changes.  How do I permanently reset my $PATH?  I'm running the most recent version of Mountain Lion.
87002
I have a symbolic link to a script in my $PATH whose file I wanted to edit.  I forgot the filepath, so I tried to do the following:  $ which my_script_link | readlink   I expected that to output the filepath, but instead it output  &gt; readlink: missing operand &gt; Try 'readlink --help' for more information   I have seen similar behavior before in other situations (like trying to pipe a list of files into vim for editing).  I know there are workarounds, like a subshell readlink $(which my_script_link), but I want to understand why piping doesn't work the way I think it should in this situation.  Thanks!
37477
There're way too many articles/resources on the web that teaches people HOW to set the environment variable PATH so that they can use the short hand of java or python etc instead of the absolute path in command line interface.  What I'm interested to know is that what's behind the scene when we type in the command and hit enter (similar to ).  Here is my guess:   read the command (parse/preprocess stdin to get the right arguments $@) command lookup command execution (program started, consume memory, stdout/stderr to shell) re-render the emulator by relevant environment variables (e.g. $PS#, $PROMPT, etc)   The part I want to figure out most is the command lookup. Obviously, the $PATH is consumed by some background function and separated by : / ;as delimiters, then what happened? Do we use a hash table (key: basename of the file, value: absolute dirname of the file) to store the binary files under those PATHs, or some other hooks?   NOTE: I originally thought it was hash table as I can use [ -z hash [command] ] to check if a command is available in current env, but when I use hash | grep python I get nothing from the output while which python works as anticipated. (I think the mechanism might be shell specific, but I want to get more insights into it.)
45392
Is it possible that a sourced shell script knows its location? I've read  but the answers focus on bash and tcsh and fail if a POSIX shell is used. .  A solution doesn't need to be 100% reliable. It's unlikely that the path contains hard or symlinks.  # sourcing the script should yield the absolute path to the script . somedir/thescript  # within “thescript” -&gt; /tmp/foo/bar/somedir   Some background: The script is part of an existing application containing dozens of binaries in a bin directory in a known location (varies per architecture) relative to the sourced script. To use the application the user sources the script which prepends the bin directory to the PATH, so the application's binaries can be easily invoked in the current shell (whichever shell that might be).
22737
I'm using Lubuntu 11.10. I have TeXlive 2011 full insttaled.   I've just installed TeXlive 2013 running install-tl script. Everything was fine. I choose the small scheme. No problem.   So according to  we should do this:     After the installation finishes, you must add the directory of TeX   Live binaries to your PATH—except on Windows, where the installer   takes care of this. For example:        PATH=/usr/local/texlive/2013/bin/i386-linux:$PATH       Use the syntax for   your shell, your installation directory, and your binary platform name   instead of i386-linux.    No problem until here. I changed my $PATH and when executing pdflatex --version on the terminal I got      pdfTeX 3.1415926-2.5-1.40.14 (TeX Live 2013)   kpathsea version 6.1.1   But I'd like to know how to take care of the last suggestion:     If you have multiple TeX installations on a given machine, you need to   change the search path to switch between them.   How to do that?