Bash Script Integer Comparison Syntax ошибкаLinux

Anonymous
Bash Script Integer Comparison Syntax ошибка

Сообщение Anonymous »

Ниже приведена логика Bash для компиляции и установки ядра Linux, если в номере патча в версии ядра Linux. < /p>

Код: Выделить всё

post_kernel_postinst() {
# Extract the new and current kernal verisons
NEW_KV=$(eselect kernel show | tail -n 1 | grep -oE '[0-9\.]{5,7}')
CURRENT_KV=$(uname -r | grep -oE '[0-9\.]{5,7}')

# Split the version strings into arrays
IFS='.' read -r -a NEW_KV_ARR 
post_kernel_postinst() {
# Extract the new and current kernal verisons
NEW_KV=$(eselect --color=no kernel show | tail -n 1 | grep -oE '[0-9.]{5,7}')
CURRENT_KV=$(uname -r | grep -oE '[0-9.]{5,7}')

# Split the version strings into arrays
IFS='.' read -r -a NEW_KV_ARR 
greninja@ash ~ $ source ./temp.sh
NEW_KV 6.14.3
CURRENT_KV 6.14.3
NEW_KERNEL_PATCH_VERSION 3
CURRENT_KERNEL_PATCH_VERSION 3
GoodBye!!

greninja@ash ~ $ post_kernel_postinst
NEW_KV 6.14.3
CURRENT_KV 6.14.3
NEW_KERNEL_PATCH_VERSION 3
CURRENT_KERNEL_PATCH_VERSION 3
GoodBye!!

greninja@ash ~ $ ./temp.sh
NEW_KV 6.14.3
CURRENT_KV 6.14.3
NEW_KERNEL_PATCH_VERSION 3
CURRENT_KERNEL_PATCH_VERSION 3
GoodBye!!

 

Подробнее здесь: [url]https://stackoverflow.com/questions/79590814/bash-script-integer-comparison-syntax-error[/url]

Вернуться в «Linux»