Webfunction abc () { appname=$1 appdir="$HOME/code/$appname" if [ mkdir $appdir -a cd $appdir ]; then echo Success else echo Failed to create and switch directory fi } When I … Web17. mar 2024 · You should use -ne since -neq is not a valid Bash conditional expression. Additionally, your Bash conditional syntax is incorrect for the use of -ne. Look at line 8 in …
"Too many arguments" when trying to change directory
Web6. dec 2003 · Forums BASH says "too many arguments" in terminal Linux - Newbie This Linux forum is for members that are new to Linux. Just starting out and have a question? If it is not in the man pages or the how-to's this is the place! Notices Welcome to LinuxQuestions.org, a friendly and active Linux Community. You are currently viewing LQ … Web82 views, 1 likes, 0 loves, 6 comments, 0 shares, Facebook Watch Videos from First United Methodist Church: First United Methodist Church was live. r01 vista shortcuts
too many arguments to function
Web有时候shell在运行的时候可能会报 too many arguments错误,出现这种错误的一般情况是出现了多值问题,也就是一个变量可能有多个值了。 例:#!/bin/sh echo "Is it morning? Please answer yes or no " read timeofday if [ $timeofday = "yes" ]; then echo "Good morning" elif [ $timeofday = "no" ];then echo "Good afternoon" else echo "Sorry,$timeofday not … Web$1 следует цитировать внутри условия if, чтобы избежать ошибки "too many arguments" и аргумент к вашему варианту должен равняться $2. Также, всегда цитирую аргументы для защиты пробелов: "my search string". WebAnother scenario that you can get the [: too many arguments or [: a: binary operator expected errors is if you try to test for all arguments "[email protected]". if [ -z "[email protected]" ] then echo "Argument required."fi . It works correctly if you call foo.sh or foo.sh arg1.But if you pass multiple args like foo.sh arg1 arg2, you will get errors. r021a