Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
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.
/home/users/test/scripts/Rman_Backup_Archi.sh: line 9: .: test: file not found
Quote:
Originally Posted by jyothinagendra
Here test is a shell script designed for setting environment variables like bash script .
Based on the error, the file test is not in the directory /home/users/scripts.
There are a couple of other issues. Such as whether or not test is a shell script file, it will need to be. It will need to be executable, and it will need a shebang term at the start of it. My parser will not accept a file with an improper extension, using that form of shell execution. Meanwhile if I use the more normal shell notation to run something, it will accept a file with no extension. That file does need to be a proper shell script file.
So, you need to post more details about things here. As others have said, use code tags because they preserve the spacing and formatting of the code. If you need assistance with that, there are guides in the LQ Site FAQ, or just use the advanced editor when you post and the # tool will make selected text into a code block.
Advice here is that providing brief, one line, not-detailed follow-ups are no further help to people. If you wish to maintain privacy of your code, then post representative examples of it.
It will need to be executable, and it will need a shebang term at the start of it.
Sorry to contradict you, but neither is true for a "sourced" script. As it will be executed BY the current shell anyway, a "shebang" will be ignored.
It doesn't need to have executable rights either, the shell will run it in either case.
Sorry to contradict you, but neither is true for a "sourced" script. As it will be executed BY the current shell anyway, a "shebang" will be ignored.
It doesn't need to have executable rights either, the shell will run it in either case.
Yes, probably, and won't argue your points. I've got bash, but it may not be a current bash. Mine shows 4.4 built back in 2016 and happens to presently be running via cygwin.
I played a bit on my shell and given the notation of DOT SPACE <script>, I could only source something which allowed execute permissions. I turned it on and off and found what I found. Meanwhile it also would not accept anything without a .sh extension.
Now if I used DOT SLASH <script> things worked far better. I still needed it to have execute permissions.
I would agree with you that the intentions of the shell should allow any file which contains shell commands to be sourced, but on my install, I only found what I found. All empirical, and not something I'm invested in disagreement about. There are those who have far more expertise with the shell than I.
It will need to be executable, and it will need a shebang term at the start of it. My parser will not accept a file with an improper extension, using that form of shell execution.
What parser is that? For bash, neither executable permission nor the shebang is needed.
When invoked as sh, Bash enters POSIX mode after reading the startup files.
The following list is what’s changed when ‘POSIX mode’ is in effect:
<snip>
42. The . and source builtins do not search the current directory for the filename argument if it is not found by searching PATH.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.