[Bio-Linux] BioLinux 8 question - Adding and removing Paths - Velvet - correction

Tim Booth tbooth at ceh.ac.uk
Wed Apr 8 14:04:09 EDT 2015


Hi Zain,

All of the behaviour you are seeing makes sense to me.  You are
suffering from some fundamental misunderstandings about how the shell
handles aliases vs. environment variables and what the permissions
errors actually mean.  No use of sudo will help you in this situation!

We cover most of this in an interactive session when I teach
introductory Linux courses with my colleagues, but unfortunately the
printed notes on the topic in our tutorial are not very good.  Therefore
I'd strongly recommend you get a book on Linux that covers learning the
quirks of the command line and take a little time to work through it.
I'll give some brief pointers below but they probably won't answer all
your questions:

> export PATH=
$PATH:/media/biolinux301/ab8abe44-b8f2-417c-81a5-276991c65d74/Velvet_Optimizer/VelvetOptimiser-2.2.5/

This adds to the end of the path, so it won't override anything already
in the system.  Put the ":$PATH" bit on the end of the line.
See:
http://rute.2038bug.com/node7.html.gz#SECTION007180000000000000000

> If I try % VelvetOptimiser.pl then the output states  fg: no current job

The error relates to the '%' sign, which represents your shell prompt
not a thing for you to type.  See:
http://en.wikibooks.org/wiki/Guide_to_Unix/Explanations/Shell_Prompt#Appearance_of_the_prompt

> I have follow up question in regards to aliases. VelvetOptimiser is
> designed specifically for look for Velveth and Velvetg and run them as
> it goes through each of the kmers. I am worried that it will seek the
> built in/old Velveth/g instead of the new compiled velveth/g.  It
> seeks the name velveth and velvetg respectively when it is executed in
> terminal. 

Aliases won't help you here because they only affect commands you type
directly in the interactive shell, so stick to manipulating the PATH
which is an environmental setting and therefore inherited.  See:
https://help.ubuntu.com/community/EnvironmentVariables#Inheritance

> I've added the following alias terms in ~/.zshrc
> 
> alias velveth="/media/biolinux301/ab8abe44-b8f2-417c-81a5-276991c65d74/Velvet_Optimizer/VelvetOptimiser-2.2.5/Velvet_Kmer303/velveth_folder"
> alias velvetg="/media/biolinux301/ab8abe44-b8f2-417c-81a5-276991c65d74/Velvet_Optimizer/VelvetOptimiser-2.2.5/Velvet_Kmer303/velvetg_folder"
> 
> If I type velveth or velvetg , I would receive an error of you do not have permission, which is strange as I am the administrator. I remember not being root could cause this occur. Could that be the reason here?

Try typing the name of any directory you can think of -
eg: /media/biolinux301
You'll get "permission denied" every time.  Unfortunately there are
various situations where you can trigger a "permission denied" error
when it has nothing to do with the permissions of your user account.

(Tony will undoubtedly point out that BASH returns a better error
message in this specific case.)

Aliases need to refer to the actual binary file, not the directory, but
as I said above they won't help you here.

> Now the strange part, is if I do sudo velveth then enter my password. Terminal will execute the built in/old velvet instead of the new one, which is strange.

It's expected behaviour.  Sudo uses a standard PATH whatever your
current setting is - run "sudo less /etc/sudoers" and look for the
"secure_path" line.  
Sudo also resets other settings in your environment, unless you tell it
not too.
But you don't need "sudo" here, as I explained above.

Best,

TIM



More information about the Bio-linux-list mailing list