Skip to content

Instantly share code, notes, and snippets.

@JacobJohansen
Created November 9, 2021 18:57
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 JacobJohansen/5f443e3a7a3898257f14ee4a2d38f8d3 to your computer and use it in GitHub Desktop.
Save JacobJohansen/5f443e3a7a3898257f14ee4a2d38f8d3 to your computer and use it in GitHub Desktop.
Script Path Relative to File
#!/bin/sh
relative_dir=`perl -e 'use Cwd "realpath";$pwd = realpath(shift); $pwd =~ s/\/[^\/]*$//; print $pwd' $0`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment