Using command line expansions...
I am to create a variable called LINUX_VERS that contains the first line of the file /var/log/dmesg. The file is to be regenerated each time machine boots (in which it is dynamically implemented). I know that the head-1 command lists files with first line. How do I input this into the .bashrc file? Also if you are being asked to create files in which the contents of the files are irrelevant, what does that mean? Thanks guys for helping me understand Linux.
|
The second part sounds very much like homework; what's the rationale
behind your requests? Cheers, Tink |
Hey that's cool. Whatever works and yes all this is homework. The second part is creating the files: untitled file, **'s and ||'s, and >> README!! <<. The first part I need guidance too...lol. Thanks I appreciate your help.
---------- Post added 04-19-11 at 07:48 PM ---------- whatever you can provide me with to help me is cool, don't have to do my homework but some good examples or something would help. |
I'd definitely bookmark & read
http://rute.2038bug.com/index.html.gz http://tldp.org/LDP/Bash-Beginners-G...tml/index.html http://www.tldp.org/LDP/abs/html/ in that order. As for the file qn; consider that creating a file does not require you to put any content into it. There's a cmd for that if you look at those links and or google around. Good luck :) |
Quote:
@OP, I think you should look into command substitution. You can use it with the other commands mentioned to extract certain parts of a file. |
Can this command for the first part be an alternative? I just want to make sure that this would work in the .bashrc file. What I did was join the two commands (the second command I know would only work if the first command is successful) like so: VAR="$VAR{LINUX_VERS}";head -1 /var/log/dmesg. Would this be a solution to regenerating the /var/log/dmesg so the variable LINUX_VERS is set dynamically when machine is booted? And if I do not get it right could someone let me know? I just do not want to clobber or screw up the ~/.bashrc file. Thanks guys and thanks for the links.
|
All times are GMT -5. The time now is 03:20 PM. |