Monday, April 15, 2024
12
rated 0 times [  12] [ 0]  / answers: 1 / hits: 1937  / 2 Years ago, wed, april 13, 2022, 1:15:25

I want to display a welcome message in the start of my script:


echo "Running $0 $@"

But $@ might be very long. How can I break this line into multiple up-to-80 character lines?


More From » command-line

 Answers
6

Use fold.


echo "Running $0 $@" | fold -sw 80

-s wraps on spaces.
-w 80 sets width to 80 columns.


[#724] Thursday, April 14, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
uxuriousrnal

Total Points: 279
Total Questions: 106
Total Answers: 96

Location: Fiji
Member since Wed, Mar 29, 2023
1 Year ago
uxuriousrnal questions
;