2014/6/11 -[ x$1 = x ] is also true if $1 is for instance " -o x" . Try sh -xc '[ x$1 = x ] && echo yes' sh ' -o x' . [ x$1 = x ] is wrong and doesn't make ...
2021/10/22 -この場合の式で "x$1" のように x といれている(何の文字列でもいい)のは、例えば $1 が空文字列だった場合にエラーになるから。先人の工夫である。
2017/10/18 -Hello. System : opensuse leap 42.3 I have a bash script that build a text file. I would like the last command doing : print_cmd -o page-left ...
2015/4/27 -The shebang is #!/bin/sh (which is dash for me). I have found similar syntax in other old shell scripts... What is the purpose of this? I guess ...
2023/7/20 -Bashでスクリプトを書く場合のポイントをまとめたBashなどで書くシェル ... ほとんどのLinuxの sh は bash へのリンクと ... x$1" = "x-h" ]; then. と ...
2023/9/12 -I've run across "X$1" recently and I'm at a loss. Anyone have any ideas what it could be? If you could illustrate your explanation with a ...
$1 is the first command-line argument passed to the shell script. Also, know as Positional parameters. It is a way to access value of the first parameter ...
2021/4/12 -... x$1" = "x-l" -o 1 -eq 1 ] (true). This ... sh was the legacy Bourne shell as late as Solaris 10 in 2009. ... Linux-related things, LinuxTags history ...
2014/4/6 -Try using the -z test: if [ -z "$1" ] && [ -z "$2" ]. From man bash : -z string True if the length of string is zero.
2019/1/6 -The +x tells tells chmod to set the execute (or search for directories) flag on. The $1 is usually used in scripts to mean the first parameter ...
A.最近何故か cal.sh に関する質問が多いですね。 多分、ある学校で課題として出題されてるのでしょうね。 >x,y,zの値に不適切な入力値がある場合や、引数の数が2つより少ない場合 &...
Q.Linuxのシェルスクリプトの添削をお願いします。 添付ファイルについて下記のように作成したのですが、次の要件を満たすためには具体的にどのように修正したらよいのでしょうか。ご回答お願い致します。...
A.問題文では「引数をインクリメントする」って書かれているのに、なんで、 >③for文((i=$1 ; i%9 ; i++))の部分を((i=$1 ; i%9 ; i++))の形で使用せず、他の構文や
Q.Linux上のbashシェルでの実数比較 (ファイルから読み込んだ値)がうまくいきません. Linux(OpenSuse11.4)上のbashでシェルを組み, 数値データを書いたファイルを読み込...
A.Cygwinでは改行コードがCR+LFなのですがLinuxではLFのみです。 CR=^Mなのでそれを取り去ればいいわけですね。 取り去る方法としては nkf -Lu bc_last.dat >