Skip to content

Instantly share code, notes, and snippets.

@genothomas
Created July 7, 2021 17:33
Show Gist options
  • Save genothomas/8589d082d35beb9848dc080cd3c35a7b to your computer and use it in GitHub Desktop.
Save genothomas/8589d082d35beb9848dc080cd3c35a7b to your computer and use it in GitHub Desktop.
#!/bin/bash
#
# Shows how awk can have use embedded bash variable
#
thedir="/tmp"
ls $thedir | awk -v thedir=$thedir '{ printf "directory %s has file %s\n",thedir,$1 }'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment