我試圖將命令行上的參數傳遞給〜/ .bash_profile中定義的函數。我已經看了一些關於stackoverflow的解決方案,但他們沒有工作。基本上,格式是這樣的:將參數傳遞給bash函數會導致錯誤
function rgrep { /usr/bin/grep -rl '[email protected]' . | /usr/bin/grep -v 'node_modules' | /usr/bin/grep -v 'bower'; }
然而,當我試試這個:
rgrep 'foo'
我得到
grep: foo: No such file or directory
' 「$ @」'而不是單引號? –
本傑明W.是正確的,但我不明白你是如何從該代碼中獲取該錯誤消息; – chepner
我也嘗試過。我嘗試了幾個排列組合。 –