Let's say you have a file 'secretfile' which contains the password 'newpass'. You want to assign the password mentioned in that file to a variable called 'pass1'. The syntax will go like this:
# cat secretfile
newpass
Method 1
# pass1=$(cat secretfile)
# echo $pass1
newpass
Method 2
# read pass1 < secretfile
# echo $pass1
newpass
# cat secretfile
newpass
Method 1
# pass1=$(cat secretfile)
# echo $pass1
newpass
Method 2
# read pass1 < secretfile
# echo $pass1
newpass
No comments:
Post a Comment