Board logo

標題: shell script for yum [打印本頁]

作者: jwschow    時間: 2021-6-27 10:44     標題: shell script for yum

#!/bin/sh

node01="pkg1 pkg2"
node02="pkg3 pkg4"

yum install (depends on hostname)  <- 呢句應該點寫?
作者: javacomhk    時間: 2021-6-27 13:22

本帖最後由 javacomhk 於 2021-6-27 18:30 編輯
#!/bin/sh

node01="pkg1 pkg2"
node02="pkg3 pkg4"

yum install (depends on hostname)


jwschow 發表於 2021-6-27 10:44



#!/bin/bash
myhostname=$(hostname); yum install ${!myhostname}

# exclamation point (!) is variable indirection for bash shell.





歡迎光臨 電腦領域 HKEPC Hardware (https://www.hkepc.com/forum/) Powered by Discuz! 7.2