Skip to content
Advertisement

BASH: How to add text in the same line after command

I have to print number of folders in my directory, so i use ls -l $1| grep "^d" | wc -l after that, I would liked to add a text in the same line. any ideas?

Advertisement

Answer

If you don’t want to use a variable to hold the output you can use echo and put your command in $( ) on that echo line.

echo $(ls -l $1| grep "^d" | wc -l ) more text to follow here
User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement