0

我有一个环境变量 admin_path=/home/myfolder/server。现在我需要基于 shell 脚本中的 $admin_path 获取父路径。我怎样才能轻松获得它?谢谢你

4

1 回答 1

1

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.

于 2013-06-24T06:25:38.267 回答