Skip to Content
For Enterprise
For Government
For Higher Ed
For Individuals
For Marketing
For Enterprise
For Government
For Higher Ed
For Individuals
For Marketing
Explore Skills
Cloud Computing
Microsoft Azure
Amazon Web Services (AWS)
Google Cloud
Cloud Migration
Cloud Deployment
Cloud Platforms
Data Engineering
Data Warehouse
SQL
Apache Spark
Microsoft SQL Server
MySQL
Kafka
Data Lake
Streaming & Messaging
NoSQL Databases
Relational Databases
Data Science
Pandas
R
MATLAB
SAS
D3
Power BI
Tableau
Statistics
Exploratory Data Analysis
Data Visualization
AI & ML
Generative AI
Machine Learning
Artificial Intelligence (AI)
Deep Learning
Reinforcement Learning
Natural Language Processing
TensorFlow
Scikit-Learn
Hyperparameter Tuning
MLOps
Programming Languages
Java
JavaScript
Spring
Python
Go
C#
C++
C
Swift
Rust
Functional Programming
Software Architecture
Object-Oriented
Distributed Systems
Domain-Driven Design
Architectural Patterns
IT/Ops
Kubernetes
Docker
GitHub
Terraform
Continuous Delivery
Continuous Integration
Database Administration
Computer Networking
Operating Systems
IT Certifications
Security
Network Security
Application Security
Incident Response
Zero Trust Model
Disaster Recovery
Penetration Testing / Ethical Hacking
Governance
Malware
Security Architecture
Security Engineering
Security Certifications
Design
Web Design
Graphic Design
Interaction Design
Film & Video
User Experience (UX)
Design Process
Design Tools
Business
Agile
Project Management
Product Management
Marketing
Human Resources
Finance
Team Management
Business Strategy
Digital Transformation
Organizational Leadership
Soft Skills
Professional Communication
Emotional Intelligence
Presentation Skills
Innovation
Critical Thinking
Public Speaking
Collaboration
Personal Productivity
Confidence / Motivation
Features
All features
Verifiable skills
AI Academy
Courses
Certifications
Interactive learning
Live events
Superstreams
Answers
Insights reporting
Radar Blog
Buy Courses
Plans
Sign In
Try Now
O'Reilly Platform
book
可编程网络自动化
by
Jason Edelman
,
Scott S. Lowe
,
Matt Oswalt
January 2023
Intermediate to advanced
458 pages
14h 16m
Chinese
Posts & Telecom Press
Content preview from
可编程网络自动化
42
|
第
3
章
因为
shellscript.sh
并不在搜索路径中,所以只能使用绝对路径。在本例中,绝对路径告诉
bash
(通过
./
)要查看当前目录。
因此,运行程序的“陷阱”在于所要运行的任何程序(经过编译的二进制程序或者由
bash
、
Python
、
Ruby
等解释器执行的
ASCII
文本脚本)需要处于搜索路径中
,否则,就必
须明确指定绝对路径(可能包含当前目录)。如果多个同名程序存在于不同的目录中,那
么
bash
先找到哪个,就执行哪个,搜索顺序则是由搜索路径决定的。
可以使用
which
命令避开这个陷阱。假设你有一个
Python
脚本
uptime
,用于收集网络设
备的正常运行时间(
uptime
)统计信息
。大多数
Linux
发行版也自带了
uptime
命令(显示
Linux
系统运行了多久)
。输入
which uptime
,
Linux
系统会告诉你在搜索路径中找到的第
一个
uptime
程序的完整路径(这就是当你只输入
uptime
的时候所要执行的程序)。根据此
信息,就可以指定
Python
脚本的完整路径,或是修改搜索路径(如果有必要的话)
。
当然可以改变并自定义搜索路径。搜索路径由名为
PATH
的
环境变量
控制。
(按照惯例,所有的环境变量名都使用大写字母。)修改环境变量
PATH
会影
响到
bash
查找程序时的搜索顺序。
在讨论
Linux
联网之前,还要再介绍另一个主题:后台程序,也称为守护进程。
3.4.4
守护进程
在
Linux
世界中,使用术语
守护进程
(
daemon
)指代运行在后台的那些进程(有时也会用
术语
服务
来描述这种后台进程) ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial
You might also like
Python和NLTK实现自然语言处理
Posts & Telecom Press, Nitin Hardeniya
Go程序设计语言
艾伦A. A.多诺万, 布莱恩W. 柯尼汉
弱监督学习实用指南
Wee Hyong Tok, Amit Bahree, Senja Filipi
Python实用技能学习指南
Posts & Telecom Press, Robert Smallshire, Austin Bingham
Publisher Resources
ISBN: 9787115606181