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