[root@coremail ~]# sh -vx test.sh #!/bin/bash uuid="88d1b3ab-2afa-4c8b-b3c3-caff80ecfda3" + uuid=88d1b3ab-2afa-4c8b-b3c3-caff80ecfda3 # 去掉uuid中的横杠uuid=${uuid//-/} # 将uuid按照每2个字符分割,并且将其转换为16进制 uuid=$(echo $uuid | sed 's/\(..\)/\\x\1/g') echo $uuid | sed 's/\(..\)/\\x\1/g') echo $uuid | sed 's/\(..\)/\\x\1/g' ++ sed 's/\(..\)/\\x\1/g' ++ echo 88d1b3ab-2afa-4c8b-b3c3-caff80ecfda3 + uuid='\x88\xd1\xb3\xab\x-2\xaf\xa-\x4c\x8b\x-b\x3c\x3-\xca\xff\x80\xec\xfd\xa3' # 转换为小写字母 uuid=$(echo -ne $uuid | xxd -r | tr '[:upper:]' '[:lower:]') echo -ne $uuid | xxd -r | tr '[:upper:]' '[:lower:]') echo -ne $uuid | xxd -r | tr '[:upper:]' '[:lower:]' ++ tr '[:upper:]' '[:lower:]' ++ xxd -r ++ echo -ne '\x88\xd1\xb3\xab\x-2\xaf\xa-\x4c\x8b\x-b\x3c\x3-\xca\xff\x80\xec\xfd\xa3' + uuid= echo $uuid + echo
时间: 2023-07-06 16:29:59 浏览: 179
在您提供的脚本中,第7行的echo命令多了一个`| sed 's/\(..\)/\\x\1/g'`,导致语法错误。修改后的脚本如下:
```bash
#!/bin/bash
uuid="88d1b3ab-2afa-4c8b-b3c3-caff80ecfda3"
# 去掉uuid中的横杠
uuid=${uuid//-/}
# 将uuid按照每2个字符分割,并且将其转换为16进制
uuid=$(echo $uuid | sed 's/\(..\)/\\x\1/g')
# 转换为小写字母
uuid=$(echo -ne $uuid | xxd -r | tr '[:upper:]' '[:lower:]')
echo $uuid
```
该脚本首先去掉uuid中的横杠,然后使用sed命令将uuid按照每2个字符分割,并且将其转换为16进制格式。接着使用xxd命令将16进制格式的uuid转换为二进制格式,并且使用tr命令将其转换为小写字母。最后输出转换后的uuid字符串。
相关问题
WARNING [tid:215057,Q:A238ACFUBhVQXEFuqWPf] Reset AutoCommit failed: coremail@jdbc:mysql://172.28.254.240:3308/cmxt_log?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true; url=jdbc:mysql://172.28.254.240:3308/cmxt_log?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true; username=coremail; exception=com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: The last packet successfully received from the server was 55,856,315 milliseconds ago. The last packet sent successfully to the server was 55,856,316 milliseconds ago. is longer than the server configured value of 'wait_timeout'. You should consider either expiring and/or testing connection validity before use in your application, increasing the server configured values for client timeouts, or using the Connector/J connection property 'autoReconnect=true' to avoid this problem.; elapsedTime=0 com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: The last packet successfully received from the server was 55,856,315 milliseconds ago. The last packet sent successfully to the server was 55,856,316 milliseconds ago. is longer than the server configured value of 'wait_timeout'. You should consider either expiring and/or testing connection validity before use in your application, increasing the server configured values for client timeouts, or using the Connector/J connection property 'autoReconnect=true' to avoid this problem.
这是一个MySQL连接超时的错误。它表示最后一次成功接收到服务器数据包的时间距离现在已经超过了服务器配置的'wait_timeout'值。解决此问题的方法有几种:
1. 在应用程序使用连接之前,可以考虑在使用之前检查连接的有效性,或者增加服务器配置中客户端超时的值。
2. 也可以使用Connector/J连接属性'autoReconnect=true'来避免此问题,这将尝试在连接断开后自动重新连接。
您可以根据具体情况选择适合您的解决方案。
mabingchen@MBC coremail % git cherry-pick 38e9564572807d7198965d009944d79c75352719 error: your local changes would be overwritten by cherry-pick. hint: commit your changes or stash them to proceed. fatal: cherry-pick failed
这个错误提示意味着在进行 cherry-pick 操作之前,你的本地仓库存在未提交的修改或者未清空的暂存区,导致该操作无法进行。你可以将本地修改提交或者暂存,然后再执行 cherry-pick 操作。如果你不希望立即提交这些修改,也可以使用 git stash 命令来暂存它们,待 cherry-pick 操作完成后再恢复这些修改。
阅读全文
相关推荐











