[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 10:29:59 浏览: 165
在您提供的脚本中,第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. 考虑增加服务器配置中客户端超时的值。通过增加'wait_timeout'的值,可以延长服务器等待连接空闲的时间。这样可以避免连接超时导致的问题。请注意,此方法可能会增加服务器资源的消耗。
3. 可以使用Connector/J连接属性'autoReconnect=true'来避免此问题。设置'autoReconnect=true'将使连接在断开后尝试自动重新连接到MySQL服务器。
根据您的具体情况选择适合您的解决方案,并根据需要进行相应的配置更改。
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 操作完成后再恢复这些修改。
阅读全文