New line characters from command output in variable.
Hi,
in man bash, section "Command Substitution" I read that new lines are removed from output: Quote:
-- Best regards, Matthew |
The only way I know is to add an extra line and remove it later. In this way the trailing newlines are preserved since they become embedded, then you can strip the added chars using parameter substitution. This will demonstrate:
Code:
#!/bin/bash Code:
$ cat testfile |
All times are GMT -5. The time now is 11:15 AM. |