I'd like to build an error handler which will make an empty file marked with the error_occur time.The core idea is to use the result of date command as a parameter.I did:time_stamp=$(date)touch $time_stampBut this turns out to create a series of empty file like 2014, Wed, 11:15:20.How to convert time_stamp to a whole string here?
How to treat strings with spaces as a whole in bash?
bash;shell;shell script
You must double quote your variable:time_stamp=$(date)touch $time_stampIn this case, double quote in $(date) is not mandatory, but it's a good practice to do that. You can read this for more understanding.