“/dev/bin/load.sh[425]: : cannot open” - Linux file redirect to empty string

L

Lalli

Guest
The below command is throwing error for some users. Can any one please explain why the error is occurring only for some users. The $EMPTY_STRING is empty for all the users.

echo $OUTPUT > $EMPTY_STRING
 


You need to give more information! What distro are you using? WHEN does it occur? What is happening to make it occur?

There is a contradiction in your post. Some users. Some users. Then "is empty for all the users"
 
Arochester,

Thanks for your reply.

The actual code in the script(/dev/bin/load.sh) is…

echo $OUTPUT > $TMPFILE

However, the developer forgot to assign a value to the variable $TMPFILE. It's not initialized/defined in the script and it's not even an environment variable. I printed the value of $TMPFILE in the log files to confirm that the environment is not setting the value to this variable. I am sure that the developer used the $TMPFILE without defining it anywhere in the OS.

The same mistake was done in several scripts years back and all are running fine. Now after building a dev instance by cloning the prod instance this line is causing the issues.

If we modify the code like this…

$TMPFILE = /tmp/load.log
echo $OUTPUT > $TMPFILE

Then the scripts are working fine.

Though code change can fix the issue, I guess there is some Linux setting which we are missing in the cloned dev environment. But, no one has any clue on what Linux setting needs to be set to fix this issue.
 

Members online


Top