Tagged Questions
2
votes
2answers
96 views
How to pass the output of a script to a command like ls without the output being split?
Suppose I have a script like this:
#!/bin/bash
printf '%q\n' "b c"
Executing the script prints:
b\ c
on the commandline.
Now, being in a directory which contains a file named b c I want to pass ...
2
votes
1answer
191 views
Command substitution: file or command not found
The following script
#!/bin/bash
QUERY='select * from cdr;'
MYROWS=$("sqlite3 -list -nullvalue NULL -separator ',' /var/log/asterisk/master.db '${QUERY}'")
gives me
./bla.sh: row 35: sqlite3 -list ...
8
votes
1answer
1k views
How can I execute `date` inside of a cron tab job?
I want to create a log file for a cron script that has the current hour in the log file name. This is the command I tried to use:
0 * * * * echo hello >> ~/cron-logs/hourly/test`date "+%d"`.log
...
3
votes
1answer
1k views
Bash: Merge foldername from variable with filename
First I write a configfile with all my parameters like this
path="/home/test/"
I name it test.conf.
Then I write a shell script with this content, name it test, and make it executable with chmod ...