I have a simple shell script as follows:
#!/bin/bash
OUTPUT="network.$(date +'%d-%m-%y').info.txt"
SUPPORT_ID="emailaddress"
echo "---------------------------------------------------" > $OUTPUT
echo "Run date and time: $(date)" >> $OUTPUT
echo "---------------------------------------------------" >> $OUTPUT
ifconfig >> $OUTPUT
echo "---------------------------------------------------" >> $OUTPUT
echo "Network info written to file: $OUTPUT."
echo "Please email this file to: $SUPPORT_ID."
It just dumps the network config into a file. At some point I will have the file emailed out, but right now I'm just trying to figure out why the output looks like the following?
bash ./test.sh
.etwork info written to file: network.26-01-25.info.txt
.lease email this file to: emailaddress
Why in the world does the initial character of the last couple of "echo" commands get clipped and turned into periods? The echos for the output of the commands piped into the output file are fine. Strange...
Any ideas?
So I edited the file using Nano (rather than BBEdit and the issue resolved. There must have been some undisplayable code at the beginning of the echo lines that was causing an issue. Very odd. But, after the Nano edit I reopened in BBEdit and turned on invisibles and I don't see any hidden characters. Too bad I didn't check that before I used Nano...