Tag: 函数

看到一个有趣的命令,但不能别名

看到这篇文章的命令https://askubuntu.com/a/266839/75967我想别名 find {,/usr}/{,s}bin -printf ‘%f\0’ | xargs -0 whatis | sort | less 我假设less或者| 是干扰,但如何使别名命令忽略导致它发出的字符? 即。 这不起作用 alias cccc=’find {,/usr}/{,s}bin -printf ‘%f\0′ | xargs -0 whatis | sort | less’ cccc 它回来了 pell0modem-manager0airserv-ng0usermod0vipw0filefrag0update-software-center0ntpdate- debian0usbmuxd0foomatic-extract-text0cupsenable0dpkg-divert0dpkg-preconfigure0foomatic- getpjloptions0ldattach0hplj10200bccmd0vpnc-disconnect0madwifi- unload0cupsd0tcpd0hplj10180pppstats0service0update-icon-caches0atieventsd0hpljP15050grub- set-default0userdel0arpd0gpsdctl0remove-shell0cpgr0winbindd0cracklib-format0update-catalog0wesside-ng0vmware-authdlauncher0aireplay-ng0install-docs0hciattach0lpc0install-menu0ck-log-system-restart0foomatic-printermap-to-gutenprint-xml0setvesablank0gconf-schemas0airmon-ng0zic0update-apt-xapian-index0pm-suspend0rebuild- 代替 [ (1) – check file types and compare values 2to3 (1) – Python2 to Python3 converter 2to3-2.7 […]

如何保护传递给cd命令的括号?

我在这里问如何制作cd保护空间。 选项卡完成很棒,但有时您会从剪贴板粘贴路径,因此这很有用。 然而,解决方案打破了括号。 无论你如何尝试逃避并保护输入,它总是返回: bash: syntax error near unexpected token `(‘ 有没有办法让它也处理括号? 我想要的是,当我输入它时,它的工作原理是: cd My path with spaces (and parentheses)

我在哪里可以放置用户定义的shell函数?

我打算创建一个能够简化我的function的function。 function就像 function lazymode() { echo “Hello World!”; } 所以当我在shell中使用命令lazymode时,它会输出Hello World! 。 我应该将用户定义的函数放在什么文件中?