I have heard that printf is better than echo and I can recall only one instance from my experience where I had to use printf because echo didn't work for feeding some text into some program on RHEL ...
I have created this Function , which generate below output on terminal , but this function seems complex, So I posted here for any improvement or for same alternate solution. #!/bin/bash function ...
This is a follow up to a question posted on SO. I've written a script called except which should print all filenames / directories except the ones given like so. $ ls a b c d $ rm $(except b d) $ ls ...
I have few lines that each of them are colon separated values, abc:def:3 Now I could do the reformat with printf plus IFS variable, while read line; do IFS=":" printf "%-20s %-16s %5d\n" ...
MYPATH=/var/www/html/error_logs/ TOTALFILE=$(ls $MYPATH* | wc -l) FILETIME=$(stat --format=%y $MYPATH* | head -5 | cut -d'.' -f1) FILE=$(ls -1tcr $MYPATH* | head -5 | rev | cut -d/ -f1 | rev) ...
Where is the offline reference of the format specifiers (e.g., %i, %s) which are supported by the Bash/system printf command? I've looked in help printf, man 1 printf and man 3 printf without luck. ...