为什么在 shell 脚本中使用 $HOME 而不是 ~ (波浪号)? [英] Why use $HOME over ~ (tilde) in a shell script?

查看:100
本文介绍了为什么在 shell 脚本中使用 $HOME 而不是 ~ (波浪号)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有任何理由在 shell 脚本中使用变量 $HOME 而不是简单的 ~(波浪号)?

Is there any reason to use the variable $HOME instead of a simple ~ (tilde) in a shell script?

推荐答案

波浪号扩展在某些情况下不起作用,例如在 /foo/bar:~/baz 之类的字符串中间

Tilde expansion doesn't work in some situations, like in the middle of strings like /foo/bar:~/baz

这篇关于为什么在 shell 脚本中使用 $HOME 而不是 ~ (波浪号)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆