Solaris / OpenSolarisThis forum is for the discussion of Solaris, OpenSolaris, OpenIndiana, and illumos.
General Sun, SunOS and Sparc related questions also go here. Any Solaris fork or distribution is welcome.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I have a script that compares two unique directories for common file variables/attributes. The script is executed as follows:
script_cmp.ksh <reference_path> <target_path>
If the user uses the full path for the <target_path> argument, the script works correctly and displays the information (validated previously during development). If I allow the user to either pass in a '.' (for PWD) or leave the 2nd argument empty (assuming PWD), the data that is returned is incorrect compared to the known and validated good data.
Is there an unknown 'gotcha' I need to be aware of with regards to expanding the '.' in a script? Thanks!
It might help if you posted some, you know, actual code. Then we might be able to spot the error.
Also, be aware that "." and ".." are not aliases or shortcuts or anything. They are real directory names, produced by the underlying filesystem to point to the current and parent directories. The shell you use has nothing to do with their definition, and should generally handle them just like any other path name, although it may be configured to treat them specially in some circumstances (ignoring them in globs, for example).
I don't understand how this relates to the OP's question. On my system, "FUNCNAME" is empty, but pwd and "." (meaning "current directory") still works.
For the OP:
In normal ksh file operations, does "." work to signify current directory? If so, then you may need to use quotes somewhere to keep it from being seen as a regex meaning "any character".
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.