在linux系统中,我们经常会利用mkdir命令创建目录,并且cd到该目录下做一些必要的工作。
例如:
[clu@portal.ny1 ~]$ mkdir -p /tmp/subdir1/subdir2/subdir3
[clu@portal.ny1 ~]$ cd /tmp/subdir1/subdir2/subdir3
[clu@portal.ny1 subdir3]$ pwd
/tmp/subdir1/subdir2/subdir3
[clu@portal.ny1 subdir3]$
那么有没有更快的方法将两条命令结合起来操作,使得我们只要执行一条命令就可以既创建了目录,也cd到该目录了尼。有的,方法如下:
在
当前用户的home目录下,
[clu@portal.ny1 ~]$ pwd
/home/staff/clu
[clu@portal.ny1 ~]$ vi .bash_profile
新增一个方法:
function mkdircd(){
mkdir -p "$@" && eval cd "\"\$$#\"";
}
然后退出,重新登陆linux。
这样直接执行:
[clu@portal.ny1 ~]$ mkdircd /tmp/subdir1/subdir2/subdir3
[clu@portal.ny1 subdir3]$ pwd
/tmp/subdir1/subdir2/subdir3
这样就快多了
--EOF--
分享到:
相关推荐
Create a Single-Page App Using Angular's Router Chapter 9. Design Great UIs with Bootstrap's Grid and Components Chapter 10. Cache Complex Queries Using Materialized Views Chapter 11. Asynchronously ...
Build an interactive and full-featured web application from scratch using Node.js and MongoDB About This Book Configure your development environment to use Node.js and MongoDB Use Node.js to connect ...
Perform Continuous Delivery and Deployment using Jenkins Test and deliver a web API Table of Contents Chapter 1. Continuous Integration, Delivery, And Deployment Foundations Chapter 2. Setting Up A Ci...
Work from the command line or Oracle Enterprise Manager, automate the backup process, perform Oracle Flashback recoveries, and integrate cloud computing technology. This authoritative resource also ...
Chapter 3. Tasks in Visual Basic Section 3.1. Types of Tasks Section 3.2. Interact with Users Section 3.3. Do Math Section 3.4. Work with Text Section 3.5. Get Dates and Times Section 3.6...
.net中进度条示例演示,ProgressBar1.PerformStep(),VB.net源代码程序
Digital systems are created to perform data processing and control tasks. What distinguishes one system from another is an architecture tailored to efficiently execute the tasks for which it was de- ...
You will also see how to execute and modify database procedures from PowerShell, run unattended, scheduled scripts, and automate database deployments using Oracle command line tools from PowerShell....
You must perform cleanup ......... 121 The termination condition ......... 121 How a garbage collector works .. 122 Member initialization ......... 125 Specifying initialization ............. 126 ...
Master the most common algorithms and data structures, and learn how to implement them efficiently using the most up-to-date features of Swift 3 About This Book Develop a deep understanding of the ...
Software Application Development: A Visual C++, MFC, and STL Tutorial provides a detailed account of the software development process using Visual C++, MFC, and STL. It covers everything from the ...
Actions that your applications can perform...........................................................................................7 Application programs using the MQI..................................
3 Application Assembler ................................................................................................................ 56 ApplicationDeployer and Administrator .........................
Data Analysis Using SQL and Excel, 2nd Edition shows you how to perform a wide range of sophisticated analyses using these simple tools, sparing you the significant expense of proprietary data mining ...
Data Analysis Using SQL and Excel, 2nd Edition shows you how to perform a wide range of sophisticated analyses using these simple tools, sparing you the significant expense of proprietary data mining ...
The emphasis is on what administrators will need to know to perform key server support and management tasks. Coverage of the systemd service management system is integrated into the book, replacing ...
This book equips the reader with skills necessary to design and build custom hardware interfaces for the Raspberry Pi. A thorough chapter on interfacing 5-volt systems to 3.3-volt Raspberry Pis ...
■■ Create a project using Visual Studio Express 2012 for Web. ■■ Create a project using Blend for Visual Studio 2012. ■■ Create a project using Visual Studio Express 2012 for Windows 8. ■■ ...
In Beginning Big Data with Power BI and Excel 2013, you will learn to solve business problems by tapping the power of Microsoft’s Excel and Power BI to import data from NoSQL and SQL databases and ...
■CHAPTER 3 Use Case Modeling. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49 The 10,000-Foot View. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ...