Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can i echo string + command in terminal

Tags:

linux

terminal

how can i 'echo' this command(NUMBER lines in my script):

Number of lines is 23.

Code:

#!/bin/bash
.
.
.
.
echo Number of line is cat $0 | wc -l
.
.
.
.

1 Answers

This should do the trick.

#!/bin/bash

echo "This script is `wc -l $0 | cut -d " " -f 1` lines long."
like image 55
fweik Avatar answered Apr 15 '26 11:04

fweik



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!