Our Online Store have the new products: RFID antenna board. Currently it can work with JC10M24R and JCOP4 card chips.
Compared with normal cards, the antenna board module has a smaller size and fixed holes, which is easy to integrate in the IOT(Internet Of Things) project.

About the method of executing scripts under LINUX to get the script path

Smartcard solutions

Moderator: product

lanzi
Posts: 39
Joined: Fri Sep 28, 2018 3:41 am
Points :200
Contact:

About the method of executing scripts under LINUX to get the script path

Post by lanzi » Tue Jan 22, 2019 4:27 am

Usually, under LINUX SHELL script execution, a lot of people often use the pwd command, most people think that can get to where the script path through this command, in fact this is a myth, the pwd command can only access to the current, script execution path, only when the execution of the SHELL script path and at the same location the pwd to get the path to the location of the script, such as the execution ./test.sh, scripts can be got through the pwd path is the execution of the script path, if you execute the /home/test.sh, The path where the script is located is different from the path where the script is executed With the pwd command, you get the path where the script is executed, not the path where the script is located.
Last edited by lanzi on Tue Jan 22, 2019 4:28 am, edited 1 time in total.

lanzi
Posts: 39
Joined: Fri Sep 28, 2018 3:41 am
Points :200
Contact:

Re: About the method of executing scripts under LINUX to get the script path

Post by lanzi » Tue Jan 22, 2019 4:28 am

How to get the path of the script in the SHELL script, as shown below:
SH_PATH = $(cd`dirname $0`;pwd)

Mean by cd `dirname $0` into the script in the path, and then execute the pwd command, can obtain the script in the path.

Post Reply Previous topicNext topic

Who is online

Users browsing this forum: No registered users and 19 guests

JavaCard OS : Disclaimer