相当于“alias mount=”mount -t ext3”的 shell 脚本?
某些第 3 方应用程序执行“mount”,我希望它的意思是“mount -t ext3”,
我知道,通常这可以通过别名来完成。 但这种情况相当罕见,我需要别名以外的东西。
(它与云计算机在另一台计算机上执行远程命令有关。不知何故别名不起作用)
我将把 /bin/mount 重命名为 /bin/mount_execute 并在 /bin/mount 创建一个脚本。
当执行“mount a b”时,我希望将其翻译为“mount -t ext3 a b”
“mount a b”-> '/bin/mount a b' -> '/bin/mount a b' -> '/bin/mount_execute -t ext3 a b'
(其中 /bin/mount 是我要求的脚本)
Some 3rd party application executes "mount" and I want it to mean "mount -t ext3"
I know, normally this can be done by alias.
But this is rather rare situation where I need something other than alias.
(it's related to cloud machine executes remote command on another machine.. somehow alias doesn't work)
I'm going to rename /bin/mount to /bin/mount_execute and create a script at /bin/mount.
when 'mount a b' is executed i'd like it to be translated to 'mount -t ext3 a b'
'mount a b' -> '/bin/mount a b' -> '/bin/mount_execute -t ext3 a b'
(where /bin/mount is the script that I am asking for)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
当
alias
不起作用时,您可以更改该程序的PATH
,以便您的挂载脚本首先出现;这样,你就不必弄乱 /bin/mount (我认为有点危险)When
alias
doesn't work, you could change thePATH
for said program, so that your mount script comes first; this way, you don't have to mess with /bin/mount (IMO a bit dangerous)是我需要的脚本。
感谢您的建议。
was the script I needed.
Thanks for suggestions.