Skip to content

Instantly share code, notes, and snippets.

@jayers99
Created April 2, 2019 16:31
Show Gist options
  • Select an option

  • Save jayers99/c493ae26b6435af6410f5a965b9228eb to your computer and use it in GitHub Desktop.

Select an option

Save jayers99/c493ae26b6435af6410f5a965b9228eb to your computer and use it in GitHub Desktop.
take a pipe list of file paths and return the directory
#!/bin/bash
# print just directory name from piped input of file paths
while read line
do
dirname "$line"
done < "${1:-/dev/stdin}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment