I'm trying to get a bash script work when automatically started after boot. (It's called in .bash_profile)
I won't post the whole script, but a more simple example, which shows exactly the same problem.
echo Test > testfile
TEST=$(more +1 testfile | head -n 1)
echo $TEST > testfile2
Called from a terminal after system bootup, the script produces a file called testfile2 which contains the word 'Test'. If I call the script from .bash_profile, the output file contains only colons, like this: "::::".
Does anybody know the reason for this?
edit: My explanation was not completely correct. It seems it only occurs when the script runs in background.(called with & afterwards)