unix shell: how to escapte a hidden directory name "." - shell

I am using AIX version 6.1.0.0. I have a hiden directory name like ".sh". When I place the directory name into a variable, I always get a cannot find file error.
file_dir=/opt/.sh/scripts
$file_dir/Find_files.sh $file_dir/file_name
Errors: cat: 0652-050 Cannot open "file_name". A file or directory in the path name does not exist.
I believe the issue is that hidden directory name ".sh". How can I go around this issue?

Without knowing the permissions on the file, directory, subdirs and which user your using its hard to be a 100% sure. But related information about this error states the following:
Possible Causes
1. This error message may be displayed during a backup operation.
2. The system looked for a file that either does not exist or was specified incorrectly.
3. The system looked for a file for which you do not have write permission.
Personally I think its a permission issue with your directory or subdir, so make sure you have the correct access or ownership.

Related

Stata can't open file saved in local cloud storage folder on Mac

I am using Stata on a Mac. I updated the OS to Monterey today. If I try to open a .dta file---that is saved on my local computer in a folder that syncs to OneDrive---from code in the Do File Editor/Command prompt (where I refer to the file using its full file path), it doesn't open. The error is r(601) - File ... cannot be found.
But if I click on it in Finder, it opens in Stata just fine. After I have done this, I can then open this file in Stata by running the exact same Stata code that didn't work before. Somehow it seems like Stata can't see the file/folder initially, but then it can. I am not sure if this has to do with the OneDrive file/folder permissions or something else.
If, in Stata, I change the directory to the correct directory using cd and then load the file (without referring to the path), it works. However, I would like to be able to refer to the file using the entire file path and not have to change the directory each time.
Interestingly, if I change the directory to the correct directory using Change working directory in the File drop down and then try to load the file using the file path, it also works. But if I do not do the drop down and write out the cd using code, and try accessing the file using the path it doesn't work!
Somehow Stata has to initially "see"/"access" the correct folder (in a very particular way) before being able to access it with the file path. Very strange. (Just to be clear, if I do not change the directory to the correct directory and then try to load the file using its file path, it doesn't work.)
I also tried creating a file using texdoc init... (in a folder that already exists, but that has not been used by Stata before) and get this error:
could not create directory .....
mkdir(): 693 could not create directory
texdoc_mkdir(): - function returned error
texdoc_init(): - function returned error
<istmt>: - function returned error
I do not get this error if I instead use another folder in the same directory that I have previously used.
I think that the error I am encountering is the same or similar to this one (with no acceptable answer): https://answers.microsoft.com/en-us/msoffice/forum/all/onedrive-folder-doesnt-exist/e6b97d47-3f6a-4863-bf68-d3a02832f2bb

How to add an alias to .bashrc file?

I am new to Ubuntu. I need to set path in my .bashrc file, but I am getting permission denied error even if am the admin of the system .
export TCFRAME_HOME=~/tcframe
alias tcframe=$TCFRAME_HOME/scripts/tcframe
Now when I type tcframe version I get
bash: /home/p46562/tcframe/scripts/tcframe: No such file or directory
How to fix this?
The error message is telling you that you are trying to execute a file which does not exist.
We can vaguely guess about what files do exist, but without access to your system, we can't know for sure what you have actually installed and where.
Perhaps you have a file named tcframe in a directory called scripts in your home directory?
alias tcframe=$HOME/scripts/tcframe
A common arrangement to avoid littering your environment with one or more aliases for each random utility you have installed somewhere is to create a dedicated directory for your PATH - a common convention is to call it bin - and populate it with symlinks to things you want to have executable.
Just once,
mkdir $HOME/bin
and edit your .profile (or .bash_profile or .bashrc if you prefer) to include the line
PATH=$HOME/bin:$PATH
From now on, to make an executable script accessible from anywhere without an explicit path, create a symlink to it in bin;
ln -s $HOME/scripts/tcframe $HOME/bin
Notice that the syntax is like cp; the last argument is the destination (which can be a directory, or a new file name) and the first (and any subsequent arguments before the last, if the last is a directory) are the sources. When the destination is a directory, the file name of each source argument is used as the name of a new symlink within the destination directory.
Also notice that you generally want to use absolute paths; a relative path is resolved relative to bin (so e.g.
ln -s ../scripts/tcframe $HOME/bin
even if you are currently in a directory where ../scripts does not exist.)
Scripts, by definition, need to be executable. If they aren't, you get "permission denied" when you try to run them. This is controlled by permissions; each file has a set of permission bits which indicate whether you can read, write to (or overwrite), and execute this file. These permissions are also set separately for members of your group (so you can manage a crude form of team access) and everyone else. But for your personal scripts, you only really care that the x (executable) bit is set for yourself. If it isn't, you can change it - this is only required once.
chmod +x scripts/tcframe

Bash Cannot Move File Into Owned Directory

Im having trouble in Bash.
I have plain files in a directory on my desktop. I am trying to move them into a subdirectory within that directory using: mv "Filename" /"Directoryname"
However when I use this command, I get an error telling me that the permission was denied.
I am set as the owner of both directories and have should have full permissions. If there is anything I need to provide you to make it easier for you to help me, I will be glad to help.
Try mv filename subDirectoryName/.
By placing / in front of the directory name in a move sequence, you're telling the shell that you would like it to be placed in a high level folder named /folder.
What you want is a sub-directory within your current directory. As you would usually move directories in bash, ../ goes up one directory, and directory/ implies you are moving into a folder that is within your current directory.

install4j: Executing bash file

I am trying to run a bash file from install4j6. install4j does indeed try to run the bash file but it just returns an error at the end of the installation. The error is very generic and has no code reference or anything that will help me determine a solution - just a message that says "Error while executing file."
The only thing I can provide is how I have it setup in install4j6 since I am pretty sure that's my issue.
The bash file is defined in the root of my installation directory distribution tree and is named set_permissions.sh. For the sake of eliminating permissions being a cause, the file permission mode is set to 777 (both in install4j and on the file system).
I believe the issue is related to what I have set as my "working directory". I currently have it set to just ".". Is there a way to debug this further? Maybe get an actual error as to why it's not executing?
Ok, first a few things to check:
make sure that you're running the batch file after the install files step (you mention it being at the root of your install)
best to have the wait for termination checked and a variable for the return code.
redirect stderr to the log file (just in case)
As for working directory, . should work, but you can change it to ${installer:sys.installationDir} to make sure that it references the installation directory chosen by the user. You can also set the executable in the form of ${installer:sys.installationDir}\set_permissions.sh
Also, try and run just your shell script to make sure that it works :)

CLIPS saving files to Virtualstore despite adding path

I am trying to save rules and facts to a specific directory in my CLIPS programs.
(save "c:\tmp\rules.clp")
(save-facts "c:\tmp\facts1")
1- But it seems CLIPS disregards the path information. Since my windows username is not the owner of the CLIPS installation directory, the files are saved in a virtual store directory:
C:\Users\USERNAME\AppData\Local\VirtualStore\Program Files (x86)\CLIPS\Bin
2- If I run a system command and include the path, the same thing happens. The path is disregarded and the notepad cannot find the intended file.
(system "notepad c:\tmp\output.txt")
Is there a way to force these commands to save/read from a specific directory?
CLIPS doesn't have the ability to override directory/files permissions set by the operating system. The path to the save/save-facts command is not modified before being passed to the system libraries for opening files (either fopen or fopen_s). I'd suggest changing the directory permissions if the user account you're using doesn't have write privileges.
I think I have found the problem.
The paths should both be included in double quotes and the slashes should be converted into forward slashes.

Resources