Skip to content

Instantly share code, notes, and snippets.

@tiagotele
Created December 13, 2019 01:53
Show Gist options
  • Save tiagotele/f2ff11335891bc697131ec173cd2e50a to your computer and use it in GitHub Desktop.
Save tiagotele/f2ff11335891bc697131ec173cd2e50a to your computer and use it in GitHub Desktop.
#!/bin/bash
##############################################################################################
# Sample to assign output from command(ls) to a variable(files) and iterate over every file
# and print its name.
##############################################################################################
files=$(ls)
echo "Printing files"
for file in $files; do
echo "$file"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment