Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I am trying to configure my windows portable git bash shell. When I execute env I get:

ANT_HOME=C:\Program Files\WinAnt
PORTABLEAPPS.COMVIDEOS:FORWARDSLASH=H:/Documents/Videos
VBOX_INSTALL_PATH=C:\Program Files\Oracle\VirtualBox\
PORTABLEAPPS.COMLOCALEWINNAME=LANG_ENGLISH
PAL:LASTPORTABLEAPPSBASEDIR:DOUBLEBACKSLASH=H:
PAL:DRIVELETTER=H   **** this is the variable I am after  ******
PAL:APPDIR=H:\PortableApps\GitPortable\App
TEMP=/tmp

The variable I am trying to reference is PAL:DRIVELETTER=H. I want to use this set my path in my .bash_profile script. This is all on a USB stick and the drive letter will of course change from time to time.

I have tried echoing:

$PAL:DRIVELETTER
${PAL:DRIVELETTER}

and numerous other things.

share|improve this question

1 Answer 1

up vote 2 down vote accepted

The problem is that PAL:DRIVELETTER is not a valid variable name in bash. Only alphanumeric and underscore are allowed. From the bash man page:

DEFINITIONS

...

name A word consisting only of alphanumeric characters and underscores, and beginning with an alphabetic character or an underscore. Also referred to as an identifier.

To get the value:

pal_driveletter=$(env |grep "^PAL:DRIVELETTER=" | cut -d= -f2-)
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.