Author:
erics , April 18th, 2022
If you want to preserve quoting to pass shell arguments to a called command, use the four characters “$@” (including the double quotes) instead of the two characters $*
Categories: How-To's , Technology Tags: Argument , Arguments , bash , Command , howto , Keep , Preserve , quote , quotes , Quoting , Save , Shell , tips
| No comments
Author:
erics , February 11th, 2021
## to add a single backslash in front of whatever char was matched
my $ password = q #abc'A1r%Fgt&jh[-#;
$ password = ~ s / ( [ '])/\\$1/g;
print qq#' $ password '\n#;
' abc \ 'A1r % Fgt & jh [ - '
## to double whatever char was matched
my $ password = q #abc'A1r%Fgt&jh[-#;
$ password = ~ s / ( [ '])/$1$1/g;
print qq#' $ password '\n#;
' abc '' A1r % Fgt & jh [ - '
## to convert ‘ to ‘\” for shell execution
my $ password = q #abc'A1r%Fgt&jh[-#;
$ passwordShell = ~ s / ( [ '])/$1\\$1$1/g;
print qq#' $ password '\n#;
' abc '\'' A1r % Fgt & jh [ - '
Categories: How-To's , Technology Tags: Backslash , Characters , double , double quotes , Escape , howto , perl , quote , quotes , Replace , Single , single quotes , Speci , Special , Special character , Substitute , tips
| No comments