I am trying to create a helpful bash alias/function. I can't seem to get it to properly interpret the string parameters.
alias phpr="php -r '${*}'"
alias decode="php -r 'echo base64_decode($1);'"
function phpr ()
{
php -r "${*}"
}
function decode ()
{
php -r "echo base64_decode($1);"
}
an example of how Im trying to use decode and it failing:
decode "MT0xO2JhbGFuY2VfaXNfc2hvd249MDtiZXRfYW1vdW50PTE7YmV0X3R5cGU9MTE7ZmF2b3JpdGVfdHJhY2sxPUZSRTtmYXZvcml0ZV90cmFjazI9TU1BO2Zhdm9yaXRlX3RyYWNrMz1UQU07ZmF2b3JpdGVfdHJhY2s0PU1FRDtmYXZvcml0ZV90cmFjazU9QVFVO3dhZ2VyX3N0YXR1cz0wO2N1cnJlbnRUcmFjaz1GUkU7Y3VycmVudFJhY2U9NjtyYWNlRGF0ZT0yMDExLTA0LTI4O3JhY2V1cGRhdGVkPTs%3D"
PHP Warning: base64_decode() expects at least 1 parameter, 0 given in Command line code on line 1
PHP Stack trace:
PHP 1. {main}() Command line code:0
PHP 2. base64_decode() Command line code:1
I'm not sure when I'd use a function vs an alias for cases like these.