[英]Azure DevOps generate a password inside of the bash task
I would like to generate a password inside of the bash task.我想在 bash 任务中生成密码。 I came up with the following:
我想出了以下内容:
- task: Bash@3
displayName: 'Bash generate password'
inputs:
targetType: 'inline'
script: |
password=$(cat /dev/urandom | tr -dc 'A-Za-z0-9_!@#$%^&*()\-+=' | fold -w 32 | head -n 1)
echo "##vso[task.setvariable variable=password]$password"
Unfortunately this seems to be not working, cause the task is running forever.不幸的是,这似乎不起作用,因为任务一直在运行。 The agent is Linux machine.
代理为Linux机。
This worked:这有效:
password=$(cat /dev/urandom | tr -dc 'A-Za-z0-9_!@#$%^&*()\-+=' | head -c24)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.