简体   繁体   中英

How to create link to script on linux

Good afternoon.

I have a script '/etc/storage/tg.sh' .

Every time when I need him, i must to write '/etc/storage/tg.sh'

How to create a link and make it a function at the root? for example so 'tg text'?

i created -> ln /etc/storage/tg.sh tg and create link on /opt/home/admin but that's not what i need.

for example i need some like logger or date function i need my new function here how to do this?

You could try ln /etc/storage/tg.sh /opt/home/admin/tg . Would that work for you?

UPDATE: fixed the path in the command.

Make a symlink using ln -s like so:

ln -s /etc/storage/tg.sh /opt/home/admin/tg

Add this directory to your PATH , for example add this to your ~/.profile file:

export PATH="/opt/home/admin:${PATH}"

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