So I write a lot of scrips for Bash and Zsh, and often make use of redirection where, for example, I generate a variable by running another command within parentheses.
As a specific example, I'd query my Floating IP and persist it to a text file for future use: -
ic is floating-ips --output JSON | jq -r '..address' > ~/floating_ip.txt
Later on, I'd look to use that Floating IP for, for example, a SSH connection, as follows: -
export floating_ip=$(cat floating_ip.txt)
Authorized uses only. All activity may be monitored and reported.
However, one of my colleague's did point out that I could reduce the number of characters typed when setting the floating_ip variable: -
export floating_ip=$(< floating_ip.txt)
See, that saves a whole two characters ....
Mind you, I can also reduce things further via: -
ssh root@$(cat floating_ip.txt)
I love shelling !