我想在Linux上执行命令,但是我应该发送base64格式的命令。
我如何解码Linux上的base64string命令,然后执行解码的string?
使用base64 -d
:
# 'string' variable contains a base64 encoded command command=$(base64 -d <<< "$string"); decode_status=$? # run the command only if decode was successful # we shouldn't enclose $command in double quotes in this case [[ $decode_status == 0 ]] && $command