![]() |
Add file content to a variable (bash)?
I am trying to create a simple shell script that will print the following message on the screen: "Your kernel is: (kernel version)".
My script is: Code:
#!/bin/bash |
Code:
kernel=`cat /home/usertest/file1` |
Yup ...you could also shorten this to
Code:
#!/bin/bash |
Want to do a one-liner ?
Code:
echo "Your kernel is `uname -r`"Add an alias in you ~/.profile Code:
alias Ver="echo \"Your kernel is `uname -r`\"Code:
# Ver |
Thank you all. What I mainly wanted was to know how to use 'cat' in a variable but your answers were even better :)
|
| All times are GMT -5. The time now is 12:50 PM. |