-
-
Save indywidualny/f46e7920973fbd8255a235018710ff12 to your computer and use it in GitHub Desktop.
When run by user everything is ok, when run through cron either line_first and line_last are empty
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
STATUS_DIR=~/status | |
# save (to file) paths to all the files in STATUS_DIR directory | |
ls -d -1 $STATUS_DIR/*.* > "$STATUS_DIR/files" | |
# read (from file) paths one by one and process the files | |
while read -r line | |
do | |
line_first=$(head -n 1 "$line") | |
line_last=$(tail -n 1 "$line") | |
echo "$line_first" | |
echo "$line_last" | |
done < "$STATUS_DIR/files" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment