пробелы вызывают ошибки.
Если вы хотите, чтобы пользователь вводил номер, когда ему будет предложено «Пожалуйста, введите номер:« Вы можете использовать свой скрипт с некоторыми исправлениями как:
#!/bin/bash
echo -n "Please enter a number: "
read number
default=10
sum=`echo "$number + $default" | bc`
echo "The sum of $number and 10 is $sum."
Проверка:
./temp.sh
Please enter a number: 50
The sum of 50 and 10 is 60.
Если вы хотите, чтобы пользователь вводил Номер в качестве аргумента для скрипта вы можете использовать скрипт ниже:
#!/bin/bash
number="$1"
default=10
sum=`echo "$number + $default" | bc`
echo "The sum of $number and 10 is $sum."
Проверка:
./temp.sh 50
The sum of 50 and 10 is 60.
Если вы хотите сопоставить текст по порядку, вы можете попробовать:
$ grep 'The.*password.*of.*user.*will.*expire.*within.*the' file
foo#foo_ehh113#The password of user 111 will expire within the next seven d
foo#foo_ehh204#The password of user 111 will expire within the next seven d
foo#foo_ehh204#The password of user 222 will expire within the next seven da
foo#foo_ehh113#The password of user 222 will expire within the next seven da
foo#foo_ehh113#The password of user 333 will expire within the next seven day
foo#foo_ehh204#The password of user 333 will expire within the next seven day
Если у вас есть файл для хранения группы текста с именем group.txt, вы можете использовать:
$ grep $(printf "%s.*" $(cat group.txt)) file
вы можете сделать это, введя следующее в командной строке, вы можете дать как угодно ключевые слова manny:
grep -E "one|two|three" file.txt
если исходный код dmesg do:
dmesg | grep -E "one|two|three"