Windows Shell Script Default Folder - windows

I'm trying to create a shell script for deploy a django application in Windows 10. I'm just at the beginning but what I want to do is:
Create the directory C:\Software\MyApp;
Clone the project from GitLab in C:\Software\MyApp;
Install virtualenv in C:\Software\MyApp\py2_env;
So I wrote this script
# setup folser
cd C:\
mkdir C:\Software\MyApp
cd C:\Software\MyApp
# clone application
git clone https://gitlab.com/blablabla/Application.git
# virtualenv
pip install virtualenv
virtualenv C:\Software\EVARplanning\py2_env
C:\Software\EVARplanning\py2_env\Script\activate
I save it in a file called installation.sh that is in my Desktop folder. The problem is that when I double-click it, it create an "Application" and "SoftwareMyApppy2_env" folder in my Desktop (C:\Users\<user>\Desktop).
The strange thing is that if I open a terminal and copy/paste those commands one by one, they work perfectly...
Can you tell me what I wrong?
Thanks

Related

How to change the command base in Git Bash in VS Code?

I'm learning to use Git. After installation I can open a Bash terminal on VS Code (I'm using Windows if that's relevant). Right after opening a Bash terminal, this command shows up automatically (the id and path are masked for privacy):
myid#machineid MINGW64 /c/Users/...
$ source C:/ProgramData/Anaconda3/Scripts/activate base
(base)
I guess it means it's using Anaconda to run the Git command. However, it appears many CMD commands that otherwise work normally in a Windows terminal don't work. For example, I can't create a new folder. This error comes up:
$ mkdir test
bash: /c/ProgramData/Anaconda3/Library/usr/bin/mkdir: Permission denied
(base)
Similarly, commands like ls or touch just don't work. But I find pwd works. I look at /c/ProgramData/Anaconda3/Library/usr/bin and see there are a bunch of CMD command exe files in there, such as mkdir.exe, rm.exe. I also look at the Git installation directory and find a folder with similar exe commands (C:\Program Files\Git\usr\bin)
On the other hand, I can still use Git commands. So this works (after manually creating the folder test):
$ git init
Initialized empty Git repository in C:/Users/.../test/.git/
(base)
Also, if I don't use VS Code, but use a Git CMD then everything works just fine.
So the question is how I can fix it? More specifically, how can I direct Git to use Git command base in VS Code instead of depending on Anaconda base? What it currently means to me is that if I uninstall Anaconda then Git may not work in VS Code at all.

Installing Github .zip files on Chromebook via Linux

I'm using a Linux Debian terminal, trying to install a Github .zip file by following a walkthrough (from Chromebook). They're using a Windows terminal and access the zip file from a G: drive. They run the following:
C:\Users\zasur>G:
G:\>cd filename.zip
G:\filename>npm install
Which installs the Github zip. I've looked all over online and tried a few different solutions but can't get past the second command they run.
I was able to open /mnt/chromeos/MyFiles/Downloads from Linux by sharing the Downloads folder with it.
I'm not sure how to change the directory from here to the filename.zip and/or run commands from it. Whenever I try to run cd filename.zip or cd /mnt/chromeos/MyFiles/Downloads/filename.zip it always fails. Is this even possible on a Chromebook?

moving WSL venv in Windows

I have started using WSL2 with windows 11.
Recently while organizing my folders I tried to copy and paste a few files created in WSL to a different location but I get the error "Error 0x80070780: The File Cannot Be Accessed by the System"
I have narrowed it to moving the python venv but I am still not getting how to move the files
Edit with additional details:
All my files are in the windows Directory only.
I am trying to copy the files from one folder to another
I am trying a simple copy and paste (ctrl-C ctrl-V)
Yes it only happens with the venv I made in WSL using
python3 -m venv ./venv
Thank you for the help

How to create a desktop-entry for anaconda on Ubuntu 17.10?

I've recently installed anaconda3 in Ubuntu 17.10 (system environment). To run anaconda-navigator, I've to activate root for each time as
Source ~/anaconda3/bin/activate root
And to run it I've to write each time
anaconda-navigator
Now I am wanted to create a desktop entry but I'm having errors at multiple stages. Can you please explain from beginning how to create a desktop-entry for anaconda3 on Linux?
EDIT: I've tried using this post on AskUbuntu. But, it failed for me. It is not showing on dock-bar as well as in /usr/share/applications. I'm really frustrated.
First, check if anaconda3 is installed on your system or not (Sometime the package may be broken due to network issues during installation (Not worked for me)). And whether you are able to launch anaconda-navigator without a desktop entry.
For creating a desktop entry
Step 1. Open your text editor and save the following content as Anaconda.desktop to your home directory.
[Desktop Entry]
Version=1.0
Type=Application
Name=Anaconda-Navigator
GenericName=Anaconda
Comment=Scientific Python Development Environment - Python3
Exec='$HOME/anaconda3/bin/anaconda-navigator'
Categories=Development;Science;IDE;Qt;Education;
Icon=$HOME/anaconda3/lib/python3.8/site-packages/anaconda_navigator/static/images/anaconda-icon-256x256.png
Terminal=false
StartupNotify=true
MimeType=text/x-python;
Take care with the Python version. in $HOME/anaconda3/lib/python3.8/site-packages/anaconda_navigator/static/images/anaconda-icon-256x256.png change python3.8 if needed
Step 2. Copy your Anaconda.desktop to /usr/share/applications/ as root (Because you might need permission to copy at /usr/share/applications/)
sudo cp Anaconda.desktop /usr/share/applications
This will create a desktop entry named Anaconda in /usr/share/applications/.
Step 3. add this line export PATH="$HOME/anaconda3/bin:$PATH" to your /etc/profile or $HOME/.bashrc
Step 4. Check if Anaconda is added to your application dock. If you didn't find it, search it in search-bar. Or you can run directly from /usr/share/applications/Anaconda.desktop.

Vagrant: how to edit files on the Vagrant server?

I'm following these instructions for setting up a Django app on Vagrant.
I have successfully completed them and started Django, but: how can I now edit the Django files within my usual text editor, TextMate?
I guess I can ssh and use vi to edit them from the command line, but I thought the point of Vagrant was to be able to use my usual editing tools.
I'm just not sure where the Django files are physically located.
Apologies if this question is off-topic, I'll happily post it elsewhere, if editors can let me know where is best.
That web site is exactly the same place I started a few months ago.
Since I've learned more about Vagrant since then, I've created my own GitHub repo. You can download it here:
https://github.com/FlipperPA/djangovagrant
The way it is setup:
git clone the repo to a local directory on your machine
cd into that directory
run "vagrant up"
the directory you run "vagrant up" in is mapped to /vagrant on the guest virtual machine
Here is a working example of the way one might do it:
cd $home
git clone https://github.com/FlipperPA/djangovagrant.git
cd djangovagrant
vagrant up
vagrant ssh djangovm
cd /vagrant
django-admin.py startproject django_project
cd django_project
python manage.py runserver [::]:8000
You will then see the Django Project build on your local machine in the "djangovagrant" folder you created by the clone command above. You can you Textmate, Sublime, or any text editor you like to edit the files locally, and they'll be mapped to the guest VM.
I hope this helps - good luck.
Vagrant always synchronizes the files in the project you set up with your PC.
So whenever you ssh into the vagrant, (usually) in /vagrant directory you can see all the files you have in the root folder of your project (directory where Vagrantfile ruby script is)
Now you can use your text editor and save the file in a folder you want (for convenience, always save new files inside the project directory). now mirroring your directory structure around the /vagrant directory you can see the file being saved in the appropriate folder in your guest machine.
For e.g if you created and saved a file in your project root folder then you can see it appear in /vagrant directory.

Resources