大致介紹Ubuntu declare使用問(wèn)題
經(jīng)過(guò)長(zhǎng)時(shí)間學(xué)習(xí)Ubuntu于是和大家分享一下,看完Ubuntu declare使用問(wèn)題你肯定有不少收獲,希望本文能教會(huì)你更多東西。在shell的執(zhí)行上用戶root和普通用戶是不一樣的。使用vi /etc/passwd我們就可以看到在用戶的最后一行也就是定義shell執(zhí)行位置的地方root的位置是/bin/bash 而其他的用戶都是/bin/sh
所以在Ubuntu中root執(zhí)行scipt的時(shí)候應(yīng)該是bash test.sh(注意在linux中是沒(méi)有文件后綴名的加上只是為了識(shí)別特殊的文件。文件能不能執(zhí)行主要是看文件屬性里面的x是否北打開(kāi))而不是sh test.sh。
#!/bin/bash
declare -i number2=10+100+1000
echo "Your result is $number1"
...:~$ sh test03-declare.sh
test03-declare.sh: 5: declare: not found
...:~$ bash test03-declare.sh
...:~$ Your result is 1110
Ubuntu declare的問(wèn)題介紹完了。
【編輯推薦】