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.
我有一个环境变量 admin_path=/home/myfolder/server。现在我需要基于 shell 脚本中的 $admin_path 获取父路径。我怎样才能轻松获得它?谢谢你
It's not entirely clear what you want, but I think you are looking for:
${admin_path%/*}
to get the value of admin_path with the trailing path component removed.
admin_path