
我有 shell 腳本文件,基本上是用於安裝 xilinx 工具的安裝文件。該檔案的名稱是 xsetup
這樣做後我還檢查了它的權限
chmod 777 xsetup
事實上,整個資料夾(我的 xsetup 就在其中)的權限是這樣的:(我對每個資料夾都進行了讀寫訪問,在此螢幕截圖中未顯示)
但是,當我嘗試執行該文件時出現錯誤:
[root@sulaptop xilinx]# sh xsetup
xsetup: line 30: ./bin/lin/xsetup: Permission denied
[root@sulaptop xilinx]# bash xsetup
xsetup: line 30: ./bin/lin/xsetup: Permission denied
[root@sulaptop xilinx]#
當我已經以 root 身分登入時,為什麼會出現此權限錯誤?這是該腳本的內容:
#! /bin/sh
export PATH || exec /bin/sh "$0" $argv
# Get the path to this exec
setuploc=`dirname "$0"`
unset LANG
platform=`uname -s`
# run setup executable depending on different platform
if [ "$platform" = "Linux" ]
then
machineType=`uname -m`; # Get the machine type
if [ "$machineType" = "x86_64" ]
then
# 64 bit
if [ -f "$setuploc/bin/lin64/xsetup" ]
then
"$setuploc/bin/lin64/xsetup" $*
else
if [ -f "$setuploc/bin/lin/xsetup" ]
then
"$setuploc/bin/lin/xsetup" $*
else
echo "Product is not supported on \"$platform\" platform."
fi
fi
else
if [ -f "$setuploc/bin/lin/xsetup" ]
then
"$setuploc/bin/lin/xsetup" $*
else
echo "Product is not supported on \"$platform $machineType\" platform."
fi
fi
else
echo "Un-supported platform: $platform"
fi
第 30 行是第一行
“$setuploc/bin/lin/xsetup”$*
從底部
平台
Fedora 17,64 位,因為我有一個有 lm 的標誌
grep lm /proc/cpuinfo:
lahf_lm ida arat epb xsaveopt pln pts dtherm tpr_shadow vnmi flexpriority ept vpid fsgsbase smep erms
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe nx rdtscp lm constant_tsc arch_perfmon pebs bts xtopology nonstop_tsc aperfmperf eagerfpu pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm
答案1
您已變更 的權限/home/msz/xilinx/xsetup
。但是,您的腳本呼叫的巢狀腳本是/home/msz/xilinx/bin/lin/xsetup
。修復正確檔案的權限。