What's new
  • SNBForums Code of Conduct

    SNBForums is a community for everyone, no matter what their level of experience.

    Please be tolerant and patient of others, especially newcomers. We are all here to share and learn!

    The rules are simple: Be patient, be nice, be helpful or be gone!

Anybody know how to set an nvram variable from a file?

  • Thread starter Thread starter Deleted member 27741
  • Start date Start date
D

Deleted member 27741

Guest
I have a file that contains a value (that is all the file contains) that I want to enter into nvram. How can I do this?

It would be extra helpful if I could set it from a particular line in the file, but I don't know if that is possible.

Reason why I am doing this is I have a curl command that gets a password from a website (vpnbook) and I want to update the nvram variable vpn_client_password with that password, maybe once a day or so.
 
The single quotes are back quotes not forward.

` not '

This is also acceptable:
Code:
nvram set vpn_client_password="$(cat /tmp/mnt/ABC/vpn-pw.txt)"
 
Yeah, it took me awhile to figure out the single quotes are on the tilde key...

```````
instead of
'''''''
Works like a charm. Thanks!
 
Yeah, it took me awhile to figure out the single quotes are on the tilde key...
If you have a US keyboard. On my UK keyboard it's on the key with a broken vertical bar (not the solid vertical bar) and a logical not symbol, as apposed to the apostrophe under the @ symbol. Simple.:eek:
 
Yeah, who could possibly be confused? :o

I like the parenthesis better! :cool:
 
I like the parenthesis better! :cool:

Technically the `` method is depreciated and $() is now the "correct" way of doing it.

But I like the old way because I easily confuse $(blah) with ${blah}, which of course means something else. :)
 
Last edited:

Latest threads

Support SNBForums w/ Amazon

If you'd like to support SNBForums, just use this link and buy anything on Amazon. Thanks!

Sign Up For SNBForums Daily Digest

Get an update of what's new every day delivered to your mailbox. Sign up here!

Staff online

Back
Top