Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我需要一个脚本,它返回 /proc/$pid/cwd 的符号链接。我写了一些代码,但它不会工作!
#!/bin/bash pid=26086 readlink /proc/$pid/cwd
我也试过:
echo $(readlink /proc/$pid/cwd)
第一个不返回任何内容,第二个给我一个空行。看起来它无法访问 /proc 但如果我手动执行此操作
# readlink /proc/26086/cwd
它有效并给了我一个符号链接!
有任何想法吗?