In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly introduces the example analysis of bash, sh,. / and source in shell, which is very detailed and has certain reference value. Friends who are interested must read it!
Sh and bash
/ bin/sh in the GNU/Linux operating system is originally a symbolic link to bash (Bourne-Again Shell), but because bash is too complex, someone migrates bash from NetBSD to Linux and renames it to dash (Debian Almquist Shell), and it is recommended to point / bin/sh to it for faster script execution. Dash Shell is much smaller than Bash Shell and meets the POSIX standard.
1. UbuntuLinux localhost 4.4.0-105-generic # 128-Ubuntu SMP Thu Dec 14 12:42:11 UTC 2017 x86 "64 GNU/Linuxxhx@localhost:~$ ls-la / bin/shlrwxrwxrwx 1 root root 4 Aug 17 2017 / bin/sh-> dash2. Centos [root @ xuhx-02 bin] # uname-aLinux xuhx-02 3.10.0-957.21.3.el7.x86_64 # 1 SMP Tue Jun 18 16:35:19 UTC 2019 x86'64 GNU/ Linux [root @ xuhx-02 bin] # ls-la shlrwxrwxrwx. 1 root root 4 June 25 16:52 sh-> bash
Sh/bash and source
Sh/bash opens the child shel and runs in the child shell. The environment variables set in the child shell will not affect the parent shell.
Source runs in the current shell, so after modifying the environment variables, you need to run source / etc/profile to make it effective instead of using the sh/bash command; source =.
. / requires r and x permissions on the executed script
[root@xuhx-02 ~] # sh t.shanaconda-ks.cfg hello n2n newdir1 pytho.py rpmbuild sort test.sh t.sh ttttt.sh [root @ xuhx-02 ~] # bash t.shanaconda-ks.cfg hello n2n newdir1 pytho.py rpmbuild sort test.sh t.sh ttttt.sh [root @ xuhx-02 ~] #. / t.sh-bash:. / t.sh: insufficient permissions [root@xuhx-02 ~] # source t.shanaconda-ks.cfg hello n2n newdir1 pytho .py rpmbuild sort test.sh t.sh ttttt.sh [root @ xuhx-02 ~] #. T.sh anaconda-ks.cfg hello n2n newdir1 pytho.py rpmbuild sort test.sh t.sh ttttt.sh and above are all the contents of this article entitled "sample Analysis of bash, sh,. /, source in shell". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.