Jump to content

Provide login session option for bash scripts


ctwise

Recommended Posts

The bash scripts aren't executed in a login session so they don't have access to the environment setup in the bash scripts. So, if I want to implement a 'run' workflow that allows me to execute any command-line application, I can't make use of 'compgen -c' in a bash script because it doesn't have access to the user's path, just the default path.

Link to comment
Share on other sites

This could be one of those cases in which the PATH that Terminal sees isn't seen by GUI apps. (There's a better way to explain that than "sees," but it's eluding me.) I know that my LaTeX installation adds something to PATH that wasn't picked up in the GUI till I followed the instructions here. Whether that means Andrew should add this I leave to the judgment of others: it's a well-known problem with OS X, but by dint of its well-known-ness, the solution is, too.

Link to comment
Share on other sites

Why not just specify path to the executable? Also, are you sure that PATH isn't available? I can easily get values for HOME and other variables from bash scripts.

 

In this specific example the idea would be to offer suggestions, e.g., 'run mount' would give you the '/sbin/mount' command, but 'run <some script in some other bin directory>' would give me that option. If I dump the PATH from a script in Alfred it's not the full path set by .bashrc, indicating it's not running a login shell (which it shouldn't by default).

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...