0
0

More than 3 years have passed since last update.

/usr/bin/[ とは何者か

Posted at

答え

testのこと。

経緯

/usr/bin/[ というファイルがあり、最初は何者か分からずteratailで質問しかけたのでメモに残す。
shファイルでそこそこ見かけるし、気づかなかった自分の醜態を晒す意味も込めて

# /usr/bin# pwd
/usr/bin
# ll \[
-rwxr-xr-x 1 root root 51384  1月 18  2018 '['*

容量やハッシュで調べてもよく分からず、試しに実行しても閉じ括弧ねーぞと怒られて終わり。

# md5sum /usr/bin/\[ 
9e0d13be90862937242d7fbfe2e05504  /usr/bin/[
# sha1sum /usr/bin/\[ 
0cd62334966e14bf21c8782b74917c00728116db  /usr/bin/[
# sha256sum /usr/bin/\[ 
d1ffbde61ddab63a1aded06d8847a5050b483623c0b798388c78f9d47422d98d  /usr/bin/[
# ./[
./[: missing `]'

でも検索したら普通に答えがありました。
https://superuser.com/questions/334549/what-is-usr-bin-and-how-do-i-use-it

確認

# [ -e /etc/hosts ];echo $?
0
# [ -e /etc/hostsssss ];echo $?
1

環境

# cat /etc/os-release | grep VERSION
VERSION="18.04.3 LTS (Bionic Beaver)"
VERSION_ID="18.04"
VERSION_CODENAME=bionic
# uname -r
4.15.0-70-generic

まとめ

ダブルクォートでくくっても[が省略された検索結果を出してくんのやめろ。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0