Skip to content

Instantly share code, notes, and snippets.

@forestbaker
Created September 29, 2015 19:10
Show Gist options
  • Save forestbaker/db04b018889aa9b0483b to your computer and use it in GitHub Desktop.
Save forestbaker/db04b018889aa9b0483b to your computer and use it in GitHub Desktop.
DEBUG - write to & read from same file
needs file descriptor and something like this
exec 10>$temp
<$temp>
#!/bin/bash -
# track path & filename for tempfile
temp="./example.tmp"
# create a list of files
printf "1n2n3n4n5n" > $temp
# read lines from tempfile
while read input_val do
echo $input_val
done < $temp # Feeds the temp file into the loop
# remove when done
rm $temp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment