Shell script input trick

In the occasion where you are not sure how long the user input might be and you want to capture it all, you would use $@ instead. In the following example, I took in the entire string and print it out word by word after breaking them into a string array according to the spaces in between.

In script run_this.sh:

userInputs=($@)
for i in "${userInputs[@]}";; do
  echo "$i"
done

Running the command:

./run_this.sh who knows how long this can go
who
knows
how
long
this
can
go



source: https://medium.freecodecamp.org/functional-and-flexible-shell-scripting-tricks-a2d693be2dd4


Create pem certificate

 Creating a .pem with the Private Key and Entire Trust Chain     Log into your DigiCert Management Console and download your Intermediate (D...

Mais vistos