Quantcast
Viewing all articles
Browse latest Browse all 4909

Raspberry Pi OS • Re: Reading the Content of a File to a Variable

export MachineID=$(<DeviceName.txt)
That is a bash-ism though. Not faster enough to be worth getting into the habit of, if you also need to write portable scripts ever. (Which in Debian-based distros, you likely do.)

Assuming the file is only one line, we have also:

Code:

read MachineID <DeviceName.txtexport MachineID

Statistics: Posted by jojopi — Fri Aug 30, 2024 4:52 pm



Viewing all articles
Browse latest Browse all 4909

Trending Articles