4
votes
4answers
453 views

Bash Scripting : Printing column data in the same row

I have written a bash script to calculate the size of a PostgreSQL database and print the output along with the date when the script was executed in a text file. The script code is as follows: ...
1
vote
2answers
173 views

Why the inconsistency with using cat vs. echo piped to this sed command?

Inspired by this question: sed: N command does not read single line I wanted to understand why there appears to be an inconsistency between the following 2 commands: #1. echo This command produces ...
4
votes
1answer
202 views

Ubuntu unattended install : echo keypress to dialog

Ubuntu 12.04 LTS Server 64 My unattended-mode bootstrap.sh script contains: apt-get upgrade -y I know that during execution a primitive UI for GRUB installation will be shown which requires ...
7
votes
4answers
12k views

printing colored text using echo

I know that for printing a colored text using echo, for example red color, the code is: echo -e "\e[1;31m This is red text \e[0m" and I know that in this example, 31 is code of red color and the ...
3
votes
2answers
4k views

How can I trim the carriage return from text that is being piped in bash?

I'm using this command to get my last typed command: history | cut -c 8- | tail -n 2 | head -n 1 It works very well in bash, removing the line numbers, but there is one problem I have with it, (er, ...