为什么在shell脚本中使用$ HOME〜〜(tilde)? [英] Why use $HOME over ~ (tilde) in a shell script?

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

问题描述

有没有理由在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〜〜(tilde)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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