Skip to main content
added 8 characters in body
Source Link
slm
  • 380k
  • 127
  • 793
  • 897

I agree with @gniourf_gniourf, your probably needing write access but not to the file descriptors, most likely a file.

You could test this by tracing the execution of your command when in the readonly partition.

{ strace -p "$$" & sleep 1; read var1 <<< "hi"; sleep 1; kill "$1"; } 

The above will run strace on the Bash shell (process $$). It then sleeps for 1 second, and then runs the readread from the HERE STRING. I've put the string "hi""hi" in this position. I then sleepsleep for one more second and then killkill the strace.

Example

While parsing this output you'll notice that a file is opened as O_WRONLY, which is for writing to a file.

open("/tmp/sh-thd-4137571604", O_WRONLY|O_CREAT|O_EXCL|O_TRUNC, 0600) = 3 

Above we can see what file is being written to by your command sequence.

I agree with @gniourf_gniourf, your probably needing write access but not to the file descriptors, most likely a file.

You could test this by tracing the execution of your command when in the readonly partition.

{ strace -p "$$" & sleep 1; read var1 <<< "hi"; sleep 1; kill "$1"; } 

The above will run strace on the Bash shell (process $$). It then sleeps for 1 second, and then runs the read from the HERE STRING. I've put the string "hi" in this position. I then sleep for one more second and then kill the strace.

Example

While parsing this output you'll notice that a file is opened as O_WRONLY, which is for writing to a file.

open("/tmp/sh-thd-4137571604", O_WRONLY|O_CREAT|O_EXCL|O_TRUNC, 0600) = 3 

Above we can see what file is being written to by your command sequence.

I agree with @gniourf_gniourf, your probably needing write access but not to the file descriptors, most likely a file.

You could test this by tracing the execution of your command when in the readonly partition.

{ strace -p "$$" & sleep 1; read var1 <<< "hi"; sleep 1; kill "$1"; } 

The above will run strace on the Bash shell (process $$). It then sleeps for 1 second, and then runs the read from the HERE STRING. I've put the string "hi" in this position. I then sleep for one more second and then kill the strace.

Example

While parsing this output you'll notice that a file is opened as O_WRONLY, which is for writing to a file.

open("/tmp/sh-thd-4137571604", O_WRONLY|O_CREAT|O_EXCL|O_TRUNC, 0600) = 3 

Above we can see what file is being written to by your command sequence.

added 68 characters in body
Source Link
slm
  • 380k
  • 127
  • 793
  • 897

I agree with @gniourf_gniourf, your probably needing write access but not to create the file descriptors for the HERE STRING, most likely a file.

You could test this by tracing the execution of your command when in the readonly partition.

{ strace -p "$$" & sleep 1; read var1 <<< "hi"; sleep 1; kill "$1"; } 

The above will run strace on the Bash shell (process $$). It then sleeps for 1 second, and then runs the read from the HERE STRING. I've put the string "hi" in this position. I then sleep for one more second and then kill the strace.

Example

While parsing this output you'll notice that read does in fact open a file foris opened as O_WRONLY, which is for writing to a file.

open("/tmp/sh-thd-4137571604", O_WRONLY|O_CREAT|O_EXCL|O_TRUNC, 0600) = 3 

Above we can see what file is being written to by your command sequence.

I agree with @gniourf_gniourf, your probably needing write access to create the file descriptors for the HERE STRING.

You could test this by tracing the execution of your command when in the readonly partition.

{ strace -p "$$" & sleep 1; read var1 <<< "hi"; sleep 1; kill "$1"; } 

The above will run strace on the Bash shell (process $$). It then sleeps for 1 second, and then runs the read from the HERE STRING. I've put the string "hi" in this position. I then sleep for one more second and then kill the strace.

Example

While parsing this output you'll notice that read does in fact open a file for O_WRONLY, which is for writing to.

open("/tmp/sh-thd-4137571604", O_WRONLY|O_CREAT|O_EXCL|O_TRUNC, 0600) = 3 

I agree with @gniourf_gniourf, your probably needing write access but not to the file descriptors, most likely a file.

You could test this by tracing the execution of your command when in the readonly partition.

{ strace -p "$$" & sleep 1; read var1 <<< "hi"; sleep 1; kill "$1"; } 

The above will run strace on the Bash shell (process $$). It then sleeps for 1 second, and then runs the read from the HERE STRING. I've put the string "hi" in this position. I then sleep for one more second and then kill the strace.

Example

While parsing this output you'll notice that a file is opened as O_WRONLY, which is for writing to a file.

open("/tmp/sh-thd-4137571604", O_WRONLY|O_CREAT|O_EXCL|O_TRUNC, 0600) = 3 

Above we can see what file is being written to by your command sequence.

Source Link
slm
  • 380k
  • 127
  • 793
  • 897

I agree with @gniourf_gniourf, your probably needing write access to create the file descriptors for the HERE STRING.

You could test this by tracing the execution of your command when in the readonly partition.

{ strace -p "$$" & sleep 1; read var1 <<< "hi"; sleep 1; kill "$1"; } 

The above will run strace on the Bash shell (process $$). It then sleeps for 1 second, and then runs the read from the HERE STRING. I've put the string "hi" in this position. I then sleep for one more second and then kill the strace.

Example

While parsing this output you'll notice that read does in fact open a file for O_WRONLY, which is for writing to.

open("/tmp/sh-thd-4137571604", O_WRONLY|O_CREAT|O_EXCL|O_TRUNC, 0600) = 3