Created
October 22, 2012 15:13
-
-
Save thinkerbot/3931961 to your computer and use it in GitHub Desktop.
Snippet examples of POSIX chores
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# path=${PATH// /_} | |
# find ${path//:/ } -name 'comv-*' | | |
printf "%s" "$PATH" | sed -e 's/:\{1,\}/\ | |
/g' | while read pathdir | |
do find "$pathdir" | |
done |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
file=$(command -v comv) | |
link=$( | |
ls -dl "$file" | awk -v "file=$file" '{ | |
sub(file, ""); | |
i=index($0, " -> "); | |
print substr($0, i+4, length - i - 3) | |
}' | |
) | |
cd "$(dirname "$(dirname "$file")/$link")" | |
pwd | |
cd - >/dev/null 2>&1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment