Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

The absolute path to how to output a file in shell

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

This article will explain in detail the absolute path of how to output files in shell. The content of the article is of high quality, so the editor will share it for you as a reference. I hope you will have a certain understanding of the relevant knowledge after reading this article.

You can put the following code in the shell initialization file, and then the pwd2 file, which outputs the current path by default. Commonly used shell initialization files ~ / .bash_profile, ~ / .zshrc, etc.

Pwd2 () {

If [$#! = 1]

Then

Pwd

Return 0

Fi

Cwwd=$PWD

If [- f $1]; then

Cd $(dirname $1)

Echo $PWD/$ (basename $1)

Elif [- d $1]; then

Cd $1

Pwd

Else

Echo "path does not exist $1"

Return-1

Fi

Cd $cwwd

}

The absolute path of how to output files in shell is shared here. I hope the above content can be helpful to you and you can learn more knowledge. If you think the article is good, you can share it for more people to see.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report