1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Linuxに入っているコマンドをランダムに表示するshellを作った

Last updated at Posted at 2018-10-16
#!/bin/sh

echo "Do you know how to use: '"$(compgen -c | gshuf -n 1)"'?"
read -p "Yes or No?(y/n)" -n 1 -r
echo 
if [[ $REPLY =~ [[Yy]$ ]]
then 
  echo "Cool! Post your knowledge to your blog or favorite site."
else 
  echo "OK, study it and then post about that."
fi
$ ./command-questions.sh 
Do you know how to use: 'ldapsearch'?
Yes or No?(y/n)n
OK, study it and then post about that.

$ ./command-questions.sh 
Do you know how to use: 'sort'?
Yes or No?(y/n)y
Cool! Post your knowledge to your blog or favorite site.
1
0
2

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
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?