基本unix ./语法 [英] basic unix ./ syntax

查看:142
本文介绍了基本unix ./语法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在从OS X终端编译c ++程序:

I'm compiling c++ programs from the OS X Terminal:

> g++ a.cpp

然后从终端运行程序:

> ./a.out

./ 语法是什么意思?这与 ./ run 有关吗?

What does the ./ syntax mean? Is this somehow related to ./run?

推荐答案

表示当前目录,因此 ./ a.out 表示 a.out 在当前目录中。如果你只键入 a.out ,而没有 ./ ,那么系统将查看目录路径( $ PATH )来查找程序,而不是查看当前目录。

. means "the current directory", so ./a.out means "the file named a.out in the current directory". If you were to type simply a.out, without the ./, then the system would look through the directories on the path ($PATH) to find the program, instead of looking in the current directory.

这篇关于基本unix ./语法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆