Shell script variable definition be careful not to duplicate the name of the system variable ...

Source: Internet
Author: User

Writing a very simple script, the results are very strange.

1 #!/bin/bash  2   3 path= $HOME/vlc_transplant4  4   5rm -F $PATH/  VLC6Ln -S $PATH/bin/vlc-static $PATH /vlc

Execution Result:

[Email protected]:~/vlc_transplant4$./update. SH . /update. SH 5 RM : Command not found. /update. SH 6 LN: Command not found

The reason is that the path variable that you define in the script replaces the system variable path, and the script originally uses the system variable path to find the command (RM, LN), and now the path is redefined in the script as $home/Vlc_transplant4, and the script takes precedence over this definition.

Change the path name in the script to change it.

1 #!/bin/bash  2   3 _path= $HOME/vlc_transplant4  4    5rm -F$_path/  VLC6Ln -S $_path/bin/ Vlc-static $_PATH/VLC

Shell script variable definition be careful not to duplicate the name of the system variable ...

Related Article

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.