Hyper not showing output of ls and touch - hyper

I Wrote ls in one of my folders from hyper but it didn't show the name of the files in the folder but instead, it showed 'ls' is not recognized as an internal or external command, operable program, or batch file. same with the touch command.

Related

Why does the alias I have created not execute in the path I am expecting?

I have created an alias that is intended to copy to my clipboard whichever path I am in, in the terminal.
The alias is in my .zshrc file.
The alias looks as follows:
alias cpath="echo -n `pwd`|pbcopy"
When I execute the following command in my terminal it always works:
echo -n `pwd`|pbcopy
However, when I use the alias cpath, it copies whichever path was the path when I first opened a particular terminal. For example, if I open a terminal in the /Users/tommyrharper directory, then I run cpath, it will copy the following path to my clipboard: /Users/tommyrharper.
If I then cd into my Documents folder, then run cpath, then it will still just add /Users/tommyrharper to my clipboard.
However If I then directly run echo -n `pwd`|pbcopy it will add /Users/tommyrharper/Documents to my clipboard.
If I initially opened a terminal in /Users/tommyrharper/Documents and then I run cpath, then it will add /Users/tommyrharper/Documents to my clipboard.
But then again if I cd into my Notes directory, then I run cpath, it will still just add /Users/tommyrharper/Documents to my clipboard.
Why is my alias not behaving in the same way as when I directly enter the command in the terminal?
And is there a way to get my alias to work as expected?
This happens because the backtick command substitution in your alias (`pwd`) gets run when zsh sources .zshrc when it starts up. This is because you have used doubles quotes, which evaluate substitutions.
You can confirm this by running alias cpath, which will display the definition of the alias, which should now include a path instead of a literal `pwd`.
If you instead define your alias like this with single quotes (which do not evaluate substitutions):
alias cpath='echo -n `pwd`|pbcopy'
it will work as expected.
More details on the different quoting styles and substitutions can be found here: https://mywiki.wooledge.org/Quotes

How to save output when running job on cluster using SLURM

I want to run an R script using SLURM. I have created the R script, "test.R" as shown:
print("Running the test script")
write.csv(head(mtcars), "mtcars_data_test.csv")
I created a bash script to run this R script "submit.sh"
#!/bin/bash
#sbatch --job-name=test.job
#sbatch --output=.out/abc.out
Rscript /home/abc/job_sub_test/test.R
And I submitted the job on the cluster
sbatch submit.sh
I am not sure where my output is saved. I looked in the home directory but no output file.
Edit
I also set my working directory in test.R, but nothing different.
setwd("/home/abc")
print("Running the test script")
write.csv(head(mtcars), "mtcars_data_test.csv")
When I run the script without SLURM Rscript test.R, it worked fine and saved the output according to the set path.
Slurm will set the job working directory to the directory which was the working directory when the sbatch command was issued.
Assuming the /home directory is mounted on all compute nodes, you can change explicitly the working directory with cd in the submission script, or setwd() in the R syntax. But that should not be necessary.
Three possibilities:
either the job did not start at all because of a configuration or hardware issue ; that you can find out with the sacct command, looking at the state column.
either the file was indeed created but on the compute node on a filesystem that is not shared; in that case the best option is to SSH to the compute node (which you can find out with sacct) and look for the file there; or
the script crashed and the file was not created at all, in that case you should look into the output file of the job (.out/abc.out). Beware that the .out directory must be present before the job starts, and that, as it starts with a ., it will be a hidden file, revealed in ls only with the -a argument.
The --output argument to sbatch is relative to the folder you submitted the job from. setwd inside the R script wouldn't affect it, because Slurm has already parsed that argument and started piping output to the file by the time the R script is running.
First, if you want the output to go to /home/abc/.out/ make sure you're in your homedir when you submit the script, or specify the full path to the --output argument.
Second, the .out folder has to exist; I tested this and Slurm does not create it if it doesn't.

Get system directory path

I want to upload an image file using an AutoIt script:
WinWaitActive("Open")
Send("D:\sprint8execution\gGastro-mvn\tmp.png")
Send("{ENTER}")
How to give the system-defined path in the script so that if the script runs on any other machine it goes to applicable directory and fetches the image from there?
Have a look to the AutoIt macros. #ScriptDir is the directory that includes the current running script.

How can I pass arguments to a command that is run via psexec.exe?

I am running the following command format:
PsExec.exe -i -s \\\\ip -u username -p password "\\\\shared\driver\path\autoitscript.exe" "\\\\shared\driver\path\car.jpg"
The exe file takes in a file path and enters the path in a file upload window. The exe file is an AutoIt script (.au3 file converted). The script uses ControlSetText to enter the file path in the upload window. I can see the exe file being run on the remote machine, but for some reason the file path is not being entered. Is there something wrong in the way i execute the psexec command? Locally the script executes correctly.
I was using ControlSetText to send the file path into the upload window. That did not work. Instead use ControlSend or Send.

How "make" command locates makefile

I am trying to understand the working of "make" command (just started on this command). I have an ".sh" file which has a script to execute "make" command as shown below:
source /somepath/environment-setup-cortexa9hf-vfp-neon-poky-linux-gnueabi
make arch=arm toolchainPrefix=arm-poky-linux-gnueabi- xeno=off mode=Debug all
The directory where the script file is located has a file named "makefile". but there is nothing specified in the script file above regarding this "makefile". After executing the script file, all the script withing "makefile" is executed automatically. Can someone explain the working of "make xyz all" command in few words.
Thanks
As often with UNIX systems the command works to some degree by conventions. make (the GNU version of make at least) will search the working directory for files called GNUmakefile, makefile, and Makefile in that order or you can use the -f (or --file) option to give it a specific file.

Resources