Skip to content

Instantly share code, notes, and snippets.

@kylejeske
Created September 29, 2019 19:40
Show Gist options
  • Save kylejeske/795eac17b0fe80450c6871db2af512e9 to your computer and use it in GitHub Desktop.
Save kylejeske/795eac17b0fe80450c6871db2af512e9 to your computer and use it in GitHub Desktop.
Bash split path

Bash - Split Path

Easy tool to split the current $PATH of the system into individual lines.

#!/bin/bash
{

  for i in $(echo "$PATH" | sed 's/:/ /g'); do echo $i;  done;

} || echo "Failed."; exit 127;

Example

ExampleStation:~ genuser1$ for i in $(echo "$PATH" | sed 's/:/ /g'); do echo $i;  done;
/usr/local/opt/llvm/bin
/usr/bin
/bin
/usr/sbin
/sbin
/usr/local/bin
/usr/local/go/bin
#!/bin/bash
{
for i in $(echo "$PATH" | sed 's/:/ /g'); do echo $i; done;
} || echo "Failed."; exit 127;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment