Help! I wanna to simplify ./hello.exe to hello.exe

软件和网站开发以及相关技术探讨
回复
qwpsmile
帖子: 7
注册时间: 2008-07-31 23:50

Help! I wanna to simplify ./hello.exe to hello.exe

#1

帖子 qwpsmile » 2008-08-10 17:20

Hi, buddies,
You know, after you compiled a c file and got a executable hello.exe file, each time, when you want to execute it, you should key in this command: ./hello.exe, it's a little tedious, isn't it?(or maybe someone don't care about that)
So, I wanna to know, how to configure my .cshrc file, that I can simply key in the exe file name each time when I want to execute a exe procedural?
头像
BigSnake.NET
帖子: 12522
注册时间: 2006-07-02 11:16
来自: 廣州
联系:

#2

帖子 BigSnake.NET » 2008-08-10 17:23

基于安全理由,不建议这样做
如果LZ知道自己在做什么,那么应该能自己找到答案
^_^ ~~~
要理解递归,首先要理解递归。

地球人都知道,理论上,理论跟实际是没有差别的,但实际上,理论跟实际的差别是相当大滴。
qwpsmile
帖子: 7
注册时间: 2008-07-31 23:50

#3

帖子 qwpsmile » 2008-08-10 17:26

Well, of course, you're right: the answer lies in the question you asked--QBQ told us this.
But why it's dangerous, will you please give some explanation?
头像
lonelycorn
帖子: 438
注册时间: 2007-05-20 18:44
来自: 唐山,河北,中国
联系:

#4

帖子 lonelycorn » 2008-08-10 22:02

what do you mean by saying"./hello.exe"?windows use "\" instead of "/".are you using wine?
我逗无了奈了……
HP的本跑ubuntu还得把我折腾死。
显卡、无线/有线网卡、声卡、键盘……

代码: 全选

while :
do
  work_hard
done
chasye
帖子: 333
注册时间: 2007-05-13 15:20

#5

帖子 chasye » 2008-08-11 0:06

tcsh:
setenv PATH ".:$PATH"

bash:
export PATH=".:$PATH"
louis315
帖子: 86
注册时间: 2005-10-20 9:19

#6

帖子 louis315 » 2008-08-11 0:15

还好啦,就多个./而已嘛.

安全总是相对的,如果把 当前路径(.) 加入到path中,自然就不用./xxx了,只是这样一来,如果很不巧,当前目录有个sh,那么运行sh时(最常见的是在运行xxxx脚本时,脚本里有用到sh(而且没有加./),那么将会运行当前目录的sh,我想这就是安全问题吧.

反正多个./也没啥的,大家在*nux里都这样用了这么多年了,也不算什么坏习惯,既然这样,那就保留这个习惯就好了.
jayscorpio
帖子: 136
注册时间: 2008-07-02 18:33
来自: Shanghai
联系:

#7

帖子 jayscorpio » 2008-08-11 8:28

修改环境变量PATH咯
头像
spider5
帖子: 351
注册时间: 2005-12-15 21:52

#8

帖子 spider5 » 2008-08-12 14:58

echo $PATH
看看有哪些可用的执行路径;如果有~/bin之类的,可以在$HOME目录下建立bin文件夹,把执行文件移动进去。
其他可以考虑用sudo 在/usr/local/bin做个符号链接,把用户目录设置为执行路径不好。
头像
lonelycorn
帖子: 438
注册时间: 2007-05-20 18:44
来自: 唐山,河北,中国
联系:

#9

帖子 lonelycorn » 2008-08-12 20:45

PATH是不是/etc/environment里面有的?
我逗无了奈了……
HP的本跑ubuntu还得把我折腾死。
显卡、无线/有线网卡、声卡、键盘……

代码: 全选

while :
do
  work_hard
done
回复