I'm trying to make elm-format work in Sublime Text and am following these instructions: https://packagecontrol.io/packages/Elm%20Language%20Support
Step one says:
"Make sure elm-format is in your PATH"
What does that mean? How do I find my path?
PATH is the environment variable holding the list of directories that will be searched when you try to execute a command (like entering elm-format on the command line).
In the terminal, you can enter echo $PATH to get a colon separated list of all the directories in your PATH.
What it means is that you'll need to get the elm-format binary (there are instructions here) and place it in one of those directories (/usr/local/bin is a common choice).
Related
I can't open the sublime application or any file via within sublime from the command line. I am currently using Git Bash(SDK-64). I followed this tutorial. I am stumped I am still getting the bash error. bash: subl.exe: command not found
Are you sure, you have Program File folder in C directory? As far as I know C directory has Program Files folder. Add s in Program File.
Write C:\Program Files\Sublime Text 3 instead of C:\\Program File\Sublime Text 3. It should work.
Is necessary to only add your Sublime directory path to the Path list, as you have done in your first pic and use only one "/".
Second step from last picture is not necessary.
Sublime will open with "subl.exe" and can take as argument the name of a file. "subl.exe dummy.txt".
I checked in Git Bash, Powershell and Developer Command Prompt for VS 2017 on win 10.
About a year ago, I created a couple text files called "compile" and "pull." When I go into a cygwin prompt and type those names and hit enter (basically use them as a command), the cygwin terminal runs what is in those text files. For instance here is the contents of one:
git checkout master
git checkout -- .
I don't even remember how I did this. I'm pretty sure this is not a bash script.
I do remember that I had to not just create the file in notepad but also perform some linux command line operation on it, in order to use it. Once I did that I could basically use the file as a command.
In *nix, you have to make a file executable in order to be able to run it:
chmod u+x file
You also need to add the path to the file to the PATH variable
PATH=$PATH:/path/to/the/file
or, add . to always scan the current directory for commands (it's considered unsecure, though):
PATH=$PATH:.
At first I had
touch $NAME_OF_FILE$DATE.$FILE_EXT
then I changed it to
PATH="Logs/"
touch $PATH$NAME_OF_FILE$DATE.$FILE_EXT
The file is created correctly in the folder, however only echos are being printed in there because says commands are not found like grep, awk, and others.
EDIT: The folder is already created on my desktop
Thanks
Alan
PATH is an environment variable that specifies where executables are located and is used by your shell to look for commands executables (grep, awk, ...). You should not override it in your script.
Try:
MYPATH="Logs/"
touch $MYPATH$NAME_OF_FILE$DATE.$FILE_EXT
To understand what PATH is open a shell and type echo $PATH. You will see it contains the directories where your commands executables are.
I am relatively new to linux so please be patient.
I just attempted to create a symlink to Sublime Text 2.
I can open Sublime Text 2 by typing
~/bin/sublime <filename>
however, simply typing
sublime <filename>
gives me a "sublime: command not found" error.
Can anyone explain what I am doing wrong?
This is because you installed sublime in a 'bin' directory inside your home folder. This 'bin' directory is not in your path and your shell will not find sublime there.
There are several solutions for this problem but a simple one is to add the '~/bin' directory to your path. To do this, just edit your file ~/.bashrc (suposing you are using bash) or ~/.profile (if you are using any other shell) and add the following line:
export PATH="$PATH:$HOME/bin"
Restart your shell or simply call source .bashrc
Let me know if this solves your problem and assign points (or mark as solved) if this answer helped you.
Best wishes.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about programming within the scope defined in the help center.
Closed 2 years ago.
Improve this question
How do I modify my user PROFILE file to append a scripts folder I created to the end of my PATH variable?
I am not totally sure what this means. Can anyone explain?
In unix/linux systems, you have a user id ('john') and a home directory ('/home/john'). The home directory has an abbreviation, the tilde: ~ (at the start of a directory path) means the same as your home directory ("/home/john").
In the home directory are several files that begin with a period (aka dot files because they start with a dot, i.e., a period). When you log in, the shell (i.e., the program that processes the command line when you type commands) that is started to supply you a command line looks for these files and reads them, using their content to initialize your shell environment. You can see these files (if they exist) by entering these commands at the command line:
cd
ls -a
The cd with no args means 'change the current directory to be my HOME directory. The ls command lists files in a directory (among other things); the -a option says 'show hidden files'. Hidden files are those that start with a period - this is the convention used in unix/linux to 'hide' files.
The .profile (said out loud it's often pronounced 'dot profile') file is one such dot file used for initializing your environment.
The PATH environment variable is used by the shell to search for executable files (programs).
You can google for 'how to update PATH in profile' and similar to learn more about the topic.
Here is a typical snippet found in a .profile file; its purpose is to allow you to run programs that are stored in the directory /usr/mypackage/bin.
PATH="/usr/mypackage/bin:$PATH"
export PATH
Putting a directory on the PATH allows you to type just a program name ('myprogram') in place of the longer form ('/usr/mypackage/bin/myprogram').
You can see the effect of this snippet using echo $PATH; it will show the entire value of the PATH variable. The value should be a list of paths (directories) separated by colon. A simple example:
echo $PATH
/usr/mypackage/bin:/usr/bin:/bin
That should give you a foothold to begin investigating the details. Trying searching for topics like 'how do I set up my linux/unix login', 'what is .profile file', etc., to learn more.
It's advisable to use double-quotes when setting the value of PATH to encapsulate any 'usual' characters that may be in the names of the items in the path. Single quotes are not suitable for this as they will prevent the evaluation of $PATH (which is what supplies your existing path when defining your new path value). For more on quotes, here is one discussion of single vs double quotes
Built-in programs like cat and cd simply work by entering the command. However, they are located in a certain folder, such as /usr/bin/. Try for yourself, and see which folder cat is located in, by entering which cat.
When you type in such command, your shell needs a list of folders in which it has to look for the command just entered. It used the $PATH variable for this, which stores this list. You can see it by entering echo $PATH.
Now, if you close your shell, the $PATH variable is gone. When you reopen your shell, it starts a certain amount of scripts, one of them being the .profile script. In this script, the $PATH variable is loaded. Therefore, you could adjust the .profile file in order to save your $PATH permanently. To do so, simply edit this file and edit the line where $PATH is defined (e.g. pico ~/.profile).
In your particular case, adding your scripts folder to the $PATH like this, will make you can simply write the name of your script instead of the whole pad when you want to launch one.
The PATH variable stores the list of directories the shell searches for programs/commands when you try to run them. You can access its value from the command line by typing:
echo $PATH
Be careful when modifying it, otherwise you could interfere with your ability to run programs from the command line. To add a new directory without modifying the original value, you could put a line in your file such as:
PATH=$PATH:/directory_to_add
where 'directory_to_add' is the directory you want to add to the path ($PATH tells the shell to insert the value of PATH). Then, if you type the name of one of the scripts in the folder at the command line, it will run without having to type the full pathname (as long as it has execute permission).
Note - your profile file can be found at ~/.profile, and you can add the line above with a text editor and resave the file. Then, from your home directory, type sh ./.profile, and your path should now include the desired directory.