View Single Post
  #1   (View Single Post)  
Old 25th January 2023
J65nko J65nko is offline
Administrator
 
Join Date: May 2008
Location: Budel - the Netherlands
Posts: 4,128
Default Pasting multiple lines in a shell script.

Challenge: Write a shell script to accept multiple lines of copied text and store these text lines in a shell variable.

Example text to be copied and pasted:
Code:
Europe
=======

Amsterdam
Brussels
Copenhagen

Africa
======

Tunis
Cairo
The empty lines must be preserved! Only exception are the lines after 'Cairo', these should not be copied and thus also not pasted into the variable.

I wrote a script myself, but wonder how somebody else would do it. After at least one person submitted a script, I will share mine here too.
__________________
You don't need to be a genius to debug a pf.conf firewall ruleset, you just need the guts to run tcpdump
Reply With Quote