简体   繁体   中英

Single command to read files from directories

I have a script on myuser@hopbox which logins to myhost1/myhost2/myhost3 and reads a particular log file for some verification
How can I handle this situation with a single cd command to login to these directories irrespective of whatever server I am on ?

The paths are :

Server Name Path

myhost1 /export/home/weblogic/jvm11/logs/ myhost2 /export/home/ weblogic /jvm12/logs/ myhost2 /export/home/ weblogic /jvm12/logs/

Create an alias in .bashrc, like

alias readlogs="cd /export/home/weblogic/jvm11/logs/; cat logfile1; ..."

Then after login, you can execute readlogs to do it in one step

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM