一道shell题
Exercise_3 - Store the output of the command “hostname” in a variable. Display “This script is running on _.” where “_” is the output of the “hostname” command.(原文)翻译:将命令“hostname”的输出存储在一个变量中。显示“此脚本正在_上运行。”其中“_”为hostname命令的输出。
思路:
#!/bin/bashHOSTNAME=$(hostname)
echo “This script is running on $HOSTNAME”
Output(要求输出结果)
$ ./exe3.sh
This script is running on vimukthi #!/bin/bash
HOSTNAME=$(hostname)
echo "This script is running on $HOSTNAME"
页:
[1]