PDA

View Full Version : Bash scripting with variables



bubbly193
January 18th, 2012, 08:14 PM
How do you log a variable

IE

#!/bin/bash
ECHO "insert some string, please"
read var
??????
##?????? is an unknown code for logging $var to ~/.results/testlogs/test-mechanics-test.log

Lars Noodén
January 18th, 2012, 08:36 PM
Do you mean something like this, using a redirect (http://mywiki.wooledge.org/BashGuide/InputAndOutput#Redirection)?



#!/bin/bash
read -p "insert some string, please" var
echo ${var} >> ~/.results/testlogs/test-mechanics-test.log