Last active
May 8, 2022 14:42
-
-
Save it3xl/e4d5c5113f99b02ec84e4a6987c5ead2 to your computer and use it in GitHub Desktop.
Splitting Long Strings and Commands in Bash
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ns=my_ns | |
my_pod=pod-of-mine | |
zuza='oppa doppa' | |
# As a direct command. | |
kubectl -n $ns exec $my_pod -- sh -c ' \ | |
val="tram '"$zuza"' pam"; \ | |
echo gu '"$zuza"' ga; \ | |
echo la la "$val" la la;' | |
# As a string command. | |
# But use back-slash to make single line commands. | |
my_command=' | |
val="tram '$zuza' pam"; | |
echo '$zuza' we use backslash here to make single line command \ | |
echo la la "$val" la la;' | |
kubectl -n $ns exec $my_pod -- sh -c "$my_command" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment