Custom home not working when console run manually (cygwin) - console

I was trying to set a new home directory for Cygwin, but the thing is I've managed to do so only partially.
I changed the 'db_home:' parameter (cygwin64/etc/nsswitch.conf) to '/windows' so it now matches the win10 default home folder, but the trick works only if mintty.exe was run through cmd.
Running mintty manually with a desktop shortcut results with the very same default directory as if the file was never changed.
Having all that said, I'm a total newbie when it comes to both Cygwin and Unix in general, so it's very likely I missed something obvious.
I appreciate any help provided, thanks in advance.

Related

Can't open input file: zsh

I'm trying to execute a .zsh script on Macos big sur and it's not letting me.
Whenever I run the .zsh in terminal, it says "/bin/zsh: can't open input file: file-name.zsh"
I already did brew install zsh prior to this so I'm a bit confused.
Any help would be greatly appreciated. Thanks!
In macOS Transparency Consent and Control (TCC) restricts access to "personal" data, including anything in a user's Desktop folder and outputs a /bin/zsh: can't open input file error message if you try to disobey this rule. Try moving file-name.zsh to a different folder, and if moving file-name.zsh to another folder doesn't help refer to file-name.zsh by using the full path to file-name.zsh.
Figured it out for ZSH on Mac! To get scripts to run from any relative directory, you can first append the rest of the path to the front of the script name and then run as usual:
BASEDIR=$(dirname "$0")
echo "Script location: ${BASEDIR}"
cd "$(dirname "$0")"
$BASEDIR/<script_name>.command
This is currently working for me on macOS Monterey.
(Copied from comment to Karel's answer about macOS ZSH + TCC policy)

The help systems return "help provider not available"

I'm using visual studio code to program in R and I have recently had trouble using the ?func and ??func command.
When typing something like ?rnorm, the message Couldn't show help for path: /library/stats/html/Normal.html shows up. The path is there and I'm sure R is in the path environment. This is really boggling me.
When I first installed R it was working absolutely fine in VSC but now it does not work. However the function works in the R shell. When I try to navigate to the R extension and click on "Help Topics by Package" it says help provider not available.
The packages/html files are there, but VSC doesn't want to access them.
Please advise what I can do to solve this.
I solved the same issue by checking my environmental variables. The steps I followed:
I added the bin installation file (C:\R\R-4.1.3\bin in my case, or C:\Program Files\R\R-4.1.3\bin) to the path in my user environmental variables. If you have an admin account, then you have to add the bin folder to the system environmental variables.
Check if you can start a R console from any terminal.
If that is positive, then in the Rpath settings for the R extension in vscode write r, or in the settings.json: "r.rpath.windows":"r"
Restart vscode. Check if the help pages are working.
Hope this helps ! Cheers.
This happened to me as well. I googled and tried different things and this works for me:
You need to provide the Rpath for the system you are using in the settings for the vscode R package. For example, for a windows machine, you need C:\Program Files\R\R-4.1.3\bin\x64\R.exe there if you installed the latest R using the default settings, and similarly for other systems.
Hope it helps!

Unix command line on PC using Ubuntu

I am new to these forums and to using Ubuntu and linux and UNIX. I really need some help here. I hope I haven't shot myself in the foot already. I have been trying to complete a UNIX carpentry lesson on the internet for an assignment. I am learning the basics about UNIX. I am not using a Mac, I am using a PC that I did not configure in any way (maybe that's my problem). I am using windows 10 on a lenovo and trying to the command prompt on Ubuntu to find my desktop where a file called "data-shell" is located. The problem: IT IS NOT FINDING THE DESKTOP. Upon further inspection, I have been looking through the location of my desktop and "data-shell" file and found it in the Users location under a number 12094, which I am assuming is the serial number for the computer. I have NEVER fiddled with the software at all with this computer as it cost me a lot of money, but I really do not want to be stopped in the tracks already. I have the following images numbered in the order that I discovered everything; they are posted here. I would really appreciate the help. P.S.: Since I am using a PC and not mac, I thought I had to use another command line like BASH or the terminal on my PCor doI just use Ubuntu? The UNIX shell is supposed to start with a $, right? Please correct me if I a wrong and thank you for your help
.
linux commands on windows can be ran via cmder or git bash (what i had used in past)
and in linux the desktop is at the path
/home/< username>/Desktop
whereas in windows its
C:\Users<username>\Desktop
both windows (DOS) and ubuntu/mac(linux) environment are entirely different you can directly run commands of one on the other environment, you do need to "setup" that env first if the command is not native to that.
Now, since its assignments that you are doing and all you need is bare-min linux env
you can give https://repl.it/ a try and create a new project in bash
Also, when you install Ubuntu on windows you dont get acces to windows like path, like "C:...", in ubuntu c:\ of windows is mounted to some other path in ubuntu
search on google how to access windows desktop from ubuntu shell after installing ubuntu inside of windows
When using Windows Subsystem for Linux (WSL), your C drive is located under /mnt/c.
Judging from the screenshot, you are user 12094, so you can either accept this, or you need to actually configure your machine. Also if you look in the screenshot you provided, there is a /home folder which I am betting is actually pointing to /mnt/c/, and your home folder will be under /home/12094, which is also the same as what is stored in $HOME.
To find the location of a file called data-shell, you can run the following linux command while in your home folder:
find $HOME -type f -name 'data-shell'
This command recursively searches for files in your home directory, with the name data-shell

Cannot change working directory to folder in windows through R in Ubuntu command line

I have had to install Ubuntu command line on windows10 in order to install R and download a package that is not supported on R for windows. This has worked fine, however, I need to set the working directory in R to the folder containing the files the package needs to work with. I have looked at lots of forums about changing directory and I have no luck!
My default working directory is a hidden folder created by windows when I installed ubuntu command line. I can access this, but I dont need this folder...I need to change the working directory in R to a folder on the D drive on my computer. I have tried to no avail!!
I have tried the normal setwd() command with the following combinations, all of which return the error 'cannot change working directory'
setwd("D:/RNA-seq data/")
setwd("d:/RNA-seq)
setwd("~D:/RNA-seq)
I am really frustrated that I cannot carry out this simple command (maybeI am doing something fundamentally wrong) or maybe this is a limitation because of the hidden default home folder set by windows? Please not I cannot transfer the necessary files in to the default folder created by windows for 'home/R' as it is on the C drive and there isnt enough space on disk. I need to navigate to the folder on d drive in order to carry out my code!!
Any help would be really really appreciated! Many thanks!

Cannot permanently Change R Working Directory - Windows 10

I am running R 3.5.0 64 bit on my Windows 10 laptop.
I can set the Working directory fine for my work space but I am unable to make a permanent change. Each time I reload it, it does not stick.
I changed my Start In file path to the new directory under properties when right clicking the icon.
I have also added setwd() with my file path in the Rprofile.site file
No matter what I do, it continues to revert back to documents when I run getwd() in R when I open it new.
Anyone have any ideas on what I can do to make it stick?
Thanks in advance
You could go the route of using an .Rprofile which is a way to run scripts / commands on startup.
Read about .Rprofile files here in Efficient R Programming
Also, has has been mentioned by #r2evans, if you're using RStudio, there is an option for setting the default working directory. It's under the General section of the Tools -> Global Options menu.

Resources