Run the mkdir and cd commands using a statement in RHEL5.4.

Source: Internet
Author: User
When we manage a Linux system, if we create a folder, the next step is to go to the new file. Have you ever thought of executing the new folder and the file in a command, this article describes how to implement this function. The following operations are successful under RHEL5.4... I will not introduce the traditional method here. As we all know, to create a directory and enter the new directory function, you need to modify a file. I am a root user directory [root @ localho

When we manage a Linux system, if we create a folder, the next step is to go to the new file. Have you ever thought of executing the new folder and the file in a command, this article describes how to implement this function.

The following operations are successful under RHEL 5.4...

I will not introduce the traditional method here. I believe everyone knows that to create a directory and enter the new directory function, you need to modify a file. I am under the root user directory.

[Root @ localhost ~] # Clear
[Root @ localhost ~] # Pwd
/Root
[Root @ localhost ~] # Vi. bash_profile
#. Bash_profile # Get the aliases and functions
If [-f ~ /. Bashrc]; then
.~ /. Bashrc
Fi # User specific environment and startup programsPATH = $ PATH: $ HOME/bin
Function mkdircd () {mkdir-p "$ @" & eval cd "\" \$ $ # \ "" ;}// this line is added
Export PATH
Unset USERNAME
~
~
~
~
~
". Bash_profile" 13L, 251C

Save the modified File

[Root @ localhost ~] # Mkdircd/mnt/test // Let's execute
-Bash: mkdircd: command not found // ha, error
[Root @ localhost ~] # Source. bash_profile // It Doesn't Matter. Execute the command to make it take effect immediately.
[Root @ localhost ~] # Mkdircd/mnt/test // try again
[Root @ localhost test] # pwd // OK
/Mnt/test

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.