Phil Colson
Phil Colson

Reputation: 141

Bash Script File Descriptor echo

echo: write error: Bad file descriptor

Throughout my code (through several bash scripts) I encounter this error. It happens when I'm trying to write or append to a (one) file.

LOGRUN_SOM_MUT_ANA=/Volumes/.../logRUN_SOMATIC_MUT_ANA

I use the absolute path for this variable and I use the same file for each script that is called. The file has a bunch of lines just like this. I use the import '.' on each script to get it.

echo "debug level set for $DEBUG_LEVEL" >> ${LOGRUN_SOM_MUT_ANA}

Worth noting:

I'd be happy to clarify anything.

launch script

errors

The second script, called from the first

Upvotes: 2

Views: 4858

Answers (2)

18446744073709551615
18446744073709551615

Reputation: 16832

For others encountering the same stupid error under cygwin in a script that works under a real Linux: no idea why, but it can happen:

1) after a syntax error in the script

2) because cygwin bash wants you to replace ./myScript.sh with . ./myScript.sh (where dot is the bash-style include directive, aka source)

Upvotes: 2

Phil Colson
Phil Colson

Reputation: 141

I figured it out, the thumb drive I'm using is encrypted. It outputs to /tmp/ so it's a permission thing. That's the problem!

Upvotes: 1

Related Questions