[20160224]-bashELF command not found.txt

简介: [20160224]-bashELF command not found.txt -- 昨天继续测试gdul,相关链接如下: http://www.itpub.net/thread-2053167-1-1.

[20160224]-bashELF command not found.txt

-- 昨天继续测试gdul,相关链接如下:
http://www.itpub.net/thread-2053167-1-1.html
http://blog.itpub.net/267265/viewspace-1992354/

--当执行如下命令配置时出现如下提示:
$ . setup
-bash:ELF: command not found

--设置调试模式检查:
$ set -x

$ . setup
+ . setup
++ $'\177ELF\002\001\001'
-bash:ELF: command not found

--检查文件开头根本不可能有什么ELF的内容。突然想起来linux下二进制文件的执行格式就是ELF。
--当这样执行时应该访问的是某个二进制文件。

$ which setup
/usr/sbin/setup
$ type setup
setup is /usr/sbin/setup

$ file /usr/sbin/setup
/usr/sbin/setup: ELF 64-bit LSB executable, AMD x86-64, version 1 (SYSV), for GNU/Linux 2.6.9, dynamically linked (uses shared libs), for GNU/Linux 2.6.9, stripped

$ xxd -c 16 /usr/sbin/setup|less
0000000: 7f45 4c46 0201 0100 0000 0000 0000 0000  .ELF............
0000010: 0200 3e00 0100 0000 3013 4000 0000 0000  ..>.....0.@.....
0000020: 4000 0000 0000 0000 b832 0000 0000 0000  @........2......
0000030: 0000 0000 4000 3800 0800 4000 1f00 1e00  ....@.8...@.....
0000040: 0600 0000 0500 0000 4000 0000 0000 0000  ........@.......
0000050: 4000 4000 0000 0000 4000 4000 0000 0000  @.@.....@.@.....
0000060: c001 0000 0000 0000 c001 0000 0000 0000  ?......?......
0000070: 0800 0000 0000 0000 0300 0000 0400 0000  ................

-- \177 => 16进制就是7f,这样正好对上。
-- 为什么昨天没事呢?仔细检查那台机器发现我同事设置了PATH环境变量如下:

$ echo $PATH
.:/usr/kerberos/bin:/usr/local/bin:/bin:/usr/bin:/usr/NX/bin:/home/oracle/bin:/home/oracle/bin:/u01/app/oracle/product/11.2.0.4/dbhome_1/bin

--而我当前的机器设置如下:
$ echo $PATH
/u01/app/oracle/product/10.2.0/rac_db/bin:/usr/sbin:/usr/lib64/qt-3.3/bin:/usr/kerberos/bin:/usr/local/bin:/bin:/usr/bin:/usr/NX/bin:/home/oracle/bin

--把当前目录设置在PATH是一个不好的习惯。因为昨天测试的PATH环境变量当前目录在最前面,而我今天测试的机器根本不包含当前目录.
--这样在访问是优先访问PATH里面存在的程序。而/usr/sbin/setup是一个ELF格式的文件,导致报错。

--如果要保证正确执行,可以使用相对路径或者绝对路径,这样就ok了。做一个记录。另外也取消原来机器PATH环境变量当前目录的设置。

$ source ./setup

--OK!

目录
相关文章
|
1月前
|
C语言 C++
关于DEV中collect2.exe [Error] ld returned 1 exit status的问题解决!!!
关于DEV中collect2.exe [Error] ld returned 1 exit status的问题解决!!!
|
3月前
|
Python
完美解决丨File “invalid.py“, line 1 print(`Hello World!`) ^ SyntaxError: invalid syntax
完美解决丨File “invalid.py“, line 1 print(`Hello World!`) ^ SyntaxError: invalid syntax
|
Linux iOS开发 MacOS
报错 sed: 1: extra characters at the end of d command
报错 sed: 1: extra characters at the end of d command
409 0
autoreconf: command not found
autoreconf: command not found
326 0
g++: command not found
g++: command not found
51 0
sed: 1: “s/os.remove(“/xx/xxx. ...“: invalid command code f
sed: 1: “s/os.remove(“/xx/xxx. ...“: invalid command code f
|
Linux Shell Windows
Shell - line 2: $‘\r‘: command not found
拷贝脚本提交后报错 line 2: $'\r': command not found,但是这是别的同学可以运行后发给我的,随后开始排查。安装 dos2unix 需要使用 yum。安装 yum 需要使用 brew。
395 0
Shell - line 2: $‘\r‘: command not found
Can‘t read file : End of file found 文件:txn_current、current svn无法正常读取文件
Can‘t read file : End of file found 文件:txn_current、current svn无法正常读取文件
Can‘t read file : End of file found 文件:txn_current、current svn无法正常读取文件
command exec make executable file not found in %PATH%
command exec make executable file not found in %PATH%
195 0
command exec make executable file not found in %PATH%

热门文章

最新文章