Skip to main content
replaced http://serverfault.com/ with https://serverfault.com/
Source Link

Just by coincidence I had to use my ATA-ID-to-device-name script (found here: http://serverfault.com/questions/244944/linux-ata-errors-translating-to-a-device-name/426561#426561https://serverfault.com/questions/244944/linux-ata-errors-translating-to-a-device-name/426561#426561) on a read-only / partition. In case you're curious, it was an Ubuntu recovery console which will let you access your / partition, but will mount it read-only by default. I am glad about that, because otherwise I would probably never have found out that my script behaves strangely on a R/O system due to a specific line, this one:

IFS=: read HostMain HostMid HostSub <<< "$HostFull" 

This does not work if there is no write permission. I wouldn't have assumed it would fail, though. But apparently the <<< operator does require to write some temporary file to somewhere.

But is there any way to circumvent the creation of a temporary file, or, is there any way to specify where the file is written to? In the Ubuntu recovery console, there is---oddly enough---write permission on the /run directory, so that would do, if I could somehow "tell" read to write the temp file to somewhere else than usual.

Just by coincidence I had to use my ATA-ID-to-device-name script (found here: http://serverfault.com/questions/244944/linux-ata-errors-translating-to-a-device-name/426561#426561) on a read-only / partition. In case you're curious, it was an Ubuntu recovery console which will let you access your / partition, but will mount it read-only by default. I am glad about that, because otherwise I would probably never have found out that my script behaves strangely on a R/O system due to a specific line, this one:

IFS=: read HostMain HostMid HostSub <<< "$HostFull" 

This does not work if there is no write permission. I wouldn't have assumed it would fail, though. But apparently the <<< operator does require to write some temporary file to somewhere.

But is there any way to circumvent the creation of a temporary file, or, is there any way to specify where the file is written to? In the Ubuntu recovery console, there is---oddly enough---write permission on the /run directory, so that would do, if I could somehow "tell" read to write the temp file to somewhere else than usual.

Just by coincidence I had to use my ATA-ID-to-device-name script (found here: https://serverfault.com/questions/244944/linux-ata-errors-translating-to-a-device-name/426561#426561) on a read-only / partition. In case you're curious, it was an Ubuntu recovery console which will let you access your / partition, but will mount it read-only by default. I am glad about that, because otherwise I would probably never have found out that my script behaves strangely on a R/O system due to a specific line, this one:

IFS=: read HostMain HostMid HostSub <<< "$HostFull" 

This does not work if there is no write permission. I wouldn't have assumed it would fail, though. But apparently the <<< operator does require to write some temporary file to somewhere.

But is there any way to circumvent the creation of a temporary file, or, is there any way to specify where the file is written to? In the Ubuntu recovery console, there is---oddly enough---write permission on the /run directory, so that would do, if I could somehow "tell" read to write the temp file to somewhere else than usual.

Old question of mine, but somehow the title is silly. We all know now: you *cannot* use here-document on r/o partition, you need to work around it *entirely*. But the old title suggests this question shows you to use here-document on r/o. NO. YOU CAN'T. You can't cast a spell on /tmp to turn to r/w.
Link
syntaxerror
  • 2.4k
  • 2
  • 31
  • 52

bash: UsingSome issue when using read <<<"$VARIABLE" on a read-only root partition. Any known workarounds?

Tweeted twitter.com/#!/StackUnix/status/396846776663433216
edited tags; edited title
Link
Gilles 'SO- stop being evil'
  • 865.9k
  • 205
  • 1.8k
  • 2.3k

bash: Using 'read' and IFSread <<<"$VARIABLE" on a read-only root partition

Source Link
syntaxerror
  • 2.4k
  • 2
  • 31
  • 52
Loading