Skip to content

Instantly share code, notes, and snippets.

@nohillside
Created December 12, 2018 16:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nohillside/b1eb0d5b0718b77384fb0daefc04dbff to your computer and use it in GitHub Desktop.
Save nohillside/b1eb0d5b0718b77384fb0daefc04dbff to your computer and use it in GitHub Desktop.
Tilde expansion for PATH in bash
pse@Mithos:~$ echo $PATH
/Users/pse/.bin/script:/Users/pse/.bin/i386:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/TeX/texbin:/usr/local/go/bin:/usr/local/MacGPG2/bin:/usr/local/mysql/bin:/opt/X11/bin:/Library/Frameworks/Mono.framework/Versions/Current/Commands
pse@Mithos:~$ PATH="~/.tmp:$PATH"
pse@Mithos:~$ echo $PATH
~/.tmp:/Users/pse/.bin/script:/Users/pse/.bin/i386:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/TeX/texbin:/usr/local/go/bin:/usr/local/MacGPG2/bin:/usr/local/mysql/bin:/opt/X11/bin:/Library/Frameworks/Mono.framework/Versions/Current/Commands
pse@Mithos:~$ cat >.tmp/foo
#!/bin/bash
echo hello world
pse@Mithos:~$ chmod +x .tmp/foo
pse@Mithos:~$ type foo
foo is /Users/pse/.tmp/foo
pse@Mithos:~$ foo
hello world
pse@Mithos:~$
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment