[solved] bash: difference `` and $()?
Hey,
i'm new to bash scripting but I'm using both of the syntaxes `` and $() quite often and they seem to do the same thing.
I believe `` just evaluates and with $() i can do an array of evaluating sequences but i'm not sure and i didn't want to dig in too deep into some bash guides right now.
Can you tell me where the difference is?
Last edited by demian (2010-05-14 13:16:52)
Trent wrote:I don't think $() is portable outside of bash. That's what I've heard, anyway.
$() is adopted and recommended by POSIX, so protability should not be a problem.
Search for command substitution in google and see by yourself
Last edited by eirika (2010-05-14 20:24:57)
Similar Messages
-
[Solved] Bash scripting and sed substitution
Hello!
I am writing a script in order to substitute strings from one array to another one in texts.
For only one case it is working as the following :
sed '/ā/s/\(.*\)ā\(.*\)/\1a\21/g' temp.txt > temp2.txt
which converts ā in a word by the same word with a normal "a" and the number 1 at the end of the word (māng > mang1)
For many cases i've made some arrays and containing the rules in a srcipt file :
# These are the 4 databases containing the strings that are suposed to be replaced
data1[1]=ā
data1[2]=ē
data1[3]=ī
data1[4]=ō
data1[5]=ū
data1[6]=ǖ
data2[7]=á
data2[8]=é
data2[9]=í
data2[10]=ó
data2[11]=ú
data2[12]=ǘ
data3[13]=ǎ
data3[14]=ě
data3[15]=ǐ
data3[16]=ǒ
data3[17]=ǔ
data3[18]=ǚ
data4[19]=à
data4[20]=è
data4[21]=ì
data4[22]=ò
data4[23]=ù
data4[24]=ǜ
# This is the data base of output correspondances
data[1]=a
data[2]=e
data[3]=i
data[4]=o
data[5]=u
data[6]=ü
count=1
for base in {1..4} # For each database
do
for case in {1..6} # For each case
do
sed "/${data${base}[$count]}/s/\(.*\)${data${base}[$count]}\(.*\)/\1${data[$case]}\2$base/g" temp.txt > temp2.txt
let "count+=1" #go to the next case in the database
cat temp2.txt > temp.txt
done
done
I have a substitution issue in the sed line. In fact I am trying to make a double substitution and it doesn't works.
Like the first substitution ${data${base}[$count]} make 3 substitutions at a time… but I can't make it to work.
In that case it would give me, for instance, the string contained in data2[3].
I hope you understand what i mean. And i'd like to know how to deal with that substitution issue if you have an idea…
Last edited by jiehong (2010-09-26 07:49:25)I've implemented what Procyon told in the part 2 and it's working with a small adaptation, which is great!!
I've just an issue now because the number will go right after a word but at the end of the ligne… even if words are spaced by a space… like :
hǎo
hào
wō wó wǒ wò wo
become :
hao3
hao4
wo wo wo wo wo1234
my sed ligne is now :
sed "/$(eval echo \$\{data$base[$count]\})/s/\(.*\)$(eval echo \$\{data$base[$count]\})\(.*\)/\1${data[$case]}\2$base/g" temp.txt > temp2.txt
Last edited by jiehong (2010-09-25 20:27:57) -
[SOLVED][bash] read and tab character
Hello archers!
I'm trying to write simple script for mysql query results parsing. And I got that `read` command "eats" tab-characters:
$ echo -e "foo\tbar\nbaz\tquuix\nfin" | while read L; do echo -e $L; done
foo bar
baz quuix
fin
i.e. tab characters were replaced with spaces.
So, I can't perform the following:
mysql -e "SELECT title,summary,body,added,modified FROM news" \
| while IFS=\t read TITLE SUMMARY BODY ADDED MODIFIED
do
echo $TITLE
done
How can I prevent such behavior?
Thanks!
Last edited by pshevtsov (2012-05-23 09:42:13)pshevtsov wrote:
So, I can't perform the following:
mysql -e "SELECT title,summary,body,added,modified FROM news" \
| while IFS=\t read TITLE SUMMARY BODY ADDED MODIFIED
do
echo $TITLE
done
How can I prevent such behavior?
Thanks!
If you want to use \t as IFS you have to quote it
mysql -e "SELECT title,summary,body,added,modified FROM news" \
| while IFS=$'\t' read TITLE SUMMARY BODY ADDED MODIFIED
do
echo $TITLE
done -
[SOLVED] Bash prompts and bell characters
Hello
This is kinda hard to explain, but I'll give a shot - with a couple of screenshots.
Notice the terminal on the left, and also at the bottom.. whenever I type in a command (or paste from somewhere) that's longer than xx characters, and hit "END" to edit the command, it goes all the way to the start of the line - but visually it's leaving the character behind, so it's impossible to see where you're editing. I suppose it has something to do with my terminal size (even tho "fullscreen" in Xmonad).
Other than that, I can't figure out why it does it, but it's really anoying.
.Xdefaults
http://codepad.org/U2VSyAUR
Thanks for any help.
Last edited by valvet (2010-11-07 18:30:05)linux-ka wrote:That's strange. I am using xmonad and rxvt-unicode-256color too, but there's no problem. I am running the current version of both of 'em. Have you upgraded xmonad/-contrib? or try to build your rxvt version on your own machine.
Also, yes - my xmonad stuff should be up to date.
Name : xmonad-darcs
Version : 20101103-1
URL : http://hackage.haskell.org/package/xmonad
Licenses : custom:BSD3
Groups : None
Provides : None
Depends On : gmp libxinerama ghc haskell-x11>=1.5.0.0 haskell-mtl
Optional Deps : None
Required By : xmonad-contrib-darcs
Conflicts With : xmonad
Replaces : None
Installed Size : 4404.00 K
Packager : Unknown Packager
Architecture : i686
Build Date : Wed 03 Nov 2010 11:13:51 PM CET
Install Date : Wed 03 Nov 2010 11:14:03 PM CET
Install Reason : Explicitly installed
Install Script : Yes
Description : A tiling window manager
Name : xmonad-contrib-darcs
Version : 20101103-1
URL : http://hackage.haskell.org/package/xmonad-contrib
Licenses : custom:BSD3
Groups : None
Provides : None
Depends On : haskell-x11-xft xmonad-darcs
Optional Deps : None
Required By : None
Conflicts With : xmonad-contrib
Replaces : None
Installed Size : 26100.00 K
Packager : Unknown Packager
Architecture : i686
Build Date : Wed 03 Nov 2010 11:16:53 PM CET
Install Date : Wed 03 Nov 2010 11:17:21 PM CET
Install Reason : Explicitly installed
Install Script : Yes
Description : Third party extensions for xmonad
Could you try with my Xdefaults file above, see if you can reproduce it? Also try using the font I am (Droid).
Thanks
Last edited by valvet (2010-11-07 02:04:57) -
SOLVED: bash upgrade, prompt issues
Just did a pacman -Syu and it fetched bash-4.0.033-1. However now whenever a open a bash shell as a user (not root), my prompt has this at the start:
0;${USER}@${HOSTNAME%%.*}:${PWD/$HOME/~} (~)
... followed by the usual [user@host ~]$
Now I assume this is caused by this line in profile.bash:
PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME%%.*}:${PWD/$HOME/~}\007"'
export PROMPT_COMMAND
Unfortunately there is no backup of said file, so I have no idea what this line used to look like. I'm going to hazard a guess that "\033]0;" should be a "[", and "\007" should be "]".
Edit: Forgot to mention that I'm using rxvt-unicode for the terminal.
Edit2: It seems the relevant file was /etc/bash.bashrc, and the solution was to simply remove rxvt-unicode from the if statement.
Last edited by ptepid (2009-09-26 11:12:25)Okay, there's something else going on here. I just happened to be messing with ANSI escape codes for something else and the same issue arose.
For instance
[ptepid@securis ~]$ echo -e "Test1 \033[1;34m Test2 \033[0m"
1;34m Test2 (~)Test1 Test2
[ptepid@securis ~]$
That echo statement should print "Test1 Test2" with test2 in blue (not shown here). It does that, but it's also spitting out the escape codes as garbage beforehand.
Turns out only one user is affected. I'm trying to hunt down what is causing it, but I can't find any ENV variables that are different. It's only happening in X, but it's a problem with both rxvt and rxvt-unicode.
SOLVED: Okay, now I feel pretty dumb. It was some bogus code in my .bashrc that was meant to update the titlebar of an xterm. That worked, but it also seems to mess with ANSI escape characters. This was the offending code:
if [[ -n "$DISPLAY" ]]; then
if [[ -n $MRXVT_TABTITLE ]]; then
trap 'echo -ne "\e]61;${BASH_COMMAND//\"/} (${PWD/$HOME/~})\a"' DEBUG
else
trap 'echo -ne "\e]0;${BASH_COMMAND//\"/} (${PWD/$HOME/~})\a"' DEBUG
fi
fi
A relic from when I'd used mrxvt.
Last edited by ptepid (2009-09-26 11:11:55) -
Hello, we have both Creative Cloud membership and Creative Cloud for team. Can you help me with the difference and if i need to have both? We have 9 employees that are using it. Just not sure if i'm paying for something i don't need.
Thank youPlease refer to Creative Cloud Help | Creative Cloud / Common Questions
CC is for retail use with 20 GB of storage space, CCT is where number of seats are purchased & assigned by one program admin where each seat gets 100GB of storage space.
You can not have both the CC & team in one account as it will only provide you added storage space of 120 GB but you can activate the CC any of them or either of them twice as CC is based on Adobe ID.
Regards
Rajshree -
I have a annual plan, it supposed must be used in two terminals, but i haven´t been able to install any app in a second computer, it always says that the app is only available as a trial download. What can I do to solve this issue, and be able to use my paid plan in two computers?
Hi Susan,
Please refer to the help document to fix this issue:
Creative Cloud applications unexpectedly revert to trial mode | CS6, CCM
You may also refer to the thread as below:
creative cloud software says my free trial has expired, but I have a paid subscription
Regards,
Sheena -
How to calculate difference and percentage in matrix report dynamic columns in SSRS 2008
Hi Friends,
I need to calculate Difference and Percentage In matrix report SSRS 2008
1) Row grouping based On Product
2) Column Grouping Week and Fiscal Year Current week and Previous Year same Weeks
3)Data Invnetory(Value fileld)
Example:
If value1 and Value2 Available we need to calculate Percentage and Difference.Otherwise Not required NA I need to Show.
For example If Particular week,Current year data is available,Previous year week data is not available No
need to cal Diff and Percentage we need to show Empty.
Below Code is working for If two values is available.
If any one of the fiscal year week data is not there it's taking some garbage values.
I tries with If condition in GetPCT() and GetDiff() It's not working.
Can some one please help me on this.
I am using the custom code
Public Shared Value1 as String
Public Shared Value2 as String
Public Shared previous as string
Public Shared previousweek as string
Public Shared Function GetValue(Value as String,partner as String,Week as String) as String
If partner =previous and Week =previousweek Then
Value2=Value
Else
previous=partner
previousweek=Week
Value1=Value
End If
return Value
End Function
Public Shared Function GetDiff()
return Value2-Value1
End Function
Public Shared Function GetPct()
return (Value2-Value1)/Value1
End Function
How to handle this.
Thank You, Manasa.VHi veerapaneni,
According to your description, if one of the fiscal year week doesn’t have data, the custom code returns false results.
For your requirement, if NULL value exists in the database, we should replace it as zero then perform calculate. So within the code, we should judge whether the value is NULL. To achieve your goal, please refer to the steps below:
1. Create a table like below.
create table dif4
([Product Group] varchar(50),
[Week] varchar(50),
[Fiscalyearweek] varchar(50),
value int
insert into dif4 values
('Desktops','W01','FY14W01',0),
('Desktops','W01','FY15W01',45),
('Desktops','W02','FY14W02',null),
('Desktops','W02','FY15W02',30),
('Desktops','W03','FY14W03',12),
('Desktops','W03','FY15W03',50),
('Notebooks','W01','FY14W01',35),
('Notebooks','W01','FY15W01',56),
('Notebooks','W02','FY14W02',45),
('Notebooks','W02','FY15W02',87),
('Notebooks','W03','FY14W03',75),
('Notebooks','W03','FY15W03',105),
('Tablets','W01','FY14W01',34),
('Tablets','W01','FY15W01',46),
('Tablets','W02','FY14W02',49),
('Tablets','W02','FY15W02',96),
('Tablets','W03','FY14W03',42),
('Tablets','W03','FY15W03',113)
2. Add the custom code in the Report Properties.
Public Shared Value1 as Integer
Public Shared Value2 as Integer
Public Shared previous as string
Public Shared previousweek as string
Public Shared Function GetValue(Value as Integer,product as String,Week as String) as Integer
If Value=Nothing Then
Value=0
End If
If product =previous and Week =previousweek Then
Value2=Value
Else
previous=product
previousweek=Week
Value1=Value
End If
return Value
End Function
Public Shared Function GetPct()
If Value1=0 Then
return 0
Else
return (Value2-Value1)/Value1
End If
End Function
Public Shared Function GetDiff()
return Value2-Value1
End Function
3. Design the matrix like below.
4. Then get the expected results.<o:p></o:p>
If you have any question, please feel free to ask.
Best regards,
Qiuyun Yu
Qiuyun Yu
TechNet Community Support -
Problem with solver DLL load and Excel 2010
Since upgrading from Office 2007 to Office 2010 we've started to experience a problem with the solver addin when our own analytics addins is also loaded. I have found a solution, but I think it may highlight a problem with the latest version of the solver
addin for Excel 2010.
Firstly, to describe the problem - the solver addin seems to load normally when Excel 2010 starts up, however when a "Solve" is performed we are seeing a "File not found: Solver32.dll" error at the final "Keep Solver Solution" stage. This only happens our
own analytics addin is loaded. We've been careful to make sure that our own addin does not change the working directory and also that it has been built against the correct Excel 2010 SDK libraries. We do not see this error with any other versions of Excel
running on the same PC or any other environment.
After some searching we found other people were having similar problems and after a bit more probing I found a solution that works - but that I'm not very happy with.
If I copy the Solver32.dll from:
C:\Program Files (x86)\Microsoft Office\Office14\Library\SOLVER
(where it was installed)
into :
C:\Windows\SysWOW64
(where Windows 7 keeps its 32 bit system DLLs)
then the problem goes away.
This seems to indicate that somehow Office 2010 has a problem that causes it to search in the wrong folder for the Solver32.dll when another addin is loaded in between the original Solver32.XLAM at start up and the use of the Solver in the sheet (which eventually
requires this DLL to be loaded). Oddly, this only happens after a solution is found and "Keep Solver Solution" is selected - and I'm not sure why it's not looking for Solver32.dll any earlier.
This is not a problem with any earlier versions of Excel and I suspect is a bug in the Office14/LIBRARY/SOLVER implementation. Is there any way to get this followed up?
Thanks,
AndyI'm facing the same issue. With an Excel VSTO add-in we're building. When the add-in is enabled the assembly solver32.dll can't be found. With our add-in disabled the DLL is resolved as (Sysinternals Process Monitor trace):
EXCEL.EXE CreateFile
C:\Program Files (x86)\Microsoft Office\Office14\Solver32.dll
EXCEL.EXE CreateFile
C:\Windows\SysWOW64\Solver32.dll
EXCEL.EXE CreateFile
C:\Windows\system\Solver32.dll
EXCEL.EXE CreateFile
C:\Windows\Solver32.dll
EXCEL.EXE CreateFile
C:\Program Files (x86)\Microsoft Office\Office14\Library\SOLVER\SOLVER32.DLL
and with our add-in enabled the following locations are tried, but solver32.dll won't be found:
excel.exe CreateFile
C:\Program Files (x86)\Microsoft Office\Office14\Solver32.dll
excel.exe CreateFile
C:\ArcGIS\______path to our add-in install location_____________\Solver32.dll
excel.exe CreateFile
C:\Windows\SysWOW64\Solver32.dll
excel.exe CreateFile
C:\Windows\system\Solver32.dll
excel.exe CreateFile
C:\Windows\Solver32.dll
excel.exe CreateFile
C:\Program Files\Common Files\Microsoft Shared\Windows Live\Solver32.dll
excel.exe CreateFile
C:\Program Files (x86)\Common Files\microsoft shared\Windows Live\Solver32.dll
excel.exe CreateFile
C:\Windows\SysWOW64\Solver32.dll
excel.exe CreateFile
C:\Windows\Solver32.dll
excel.exe CreateFile
C:\Windows\SysWOW64\wbem\Solver32.dll
etc... -
How to invoke BASH shell and execute a command in that shell in Windows 98
Hello, I have a problem and if somebody will help me, I will be very glad. Thank you.
I am using BASH shell on Windows 98 OS by means of CYGWIN. And I want to invoke this BASH shell and execute a preprogrammed command in the shell (./scan fileName.txt) from a JAVA program. But so far, I am not sucessful. I can not read or write anything from / to BASH shell. It either blocks and freezes (When I use waitFor( ) ) or appears and disappears without executing scan command (When I do not use waitFor( ) ). My code is like this:
// This method is used for compiling a file.
// It invokes BASH shell and executes "./scan fileName.txt" command
public void compileFileMethod () {
try {
Process proc = ( Runtime.getRuntime() ).exec ("C:\\MyDocuments\\CYGWIN.BAT); //I also tried to add -c ./scan fileName.txt after .BAT );
// I also tried to write "C:\\MyDocuments\\BASH.EXE" but it did not help
OutputStream ostr = proc.getOutputStream();
BufferedWriter bw = new BufferedWriter ( new OutputStreamWriter (ostr) );
InputStream istr = proc.getInputStream();
BufferedReader br = new BufferedReader ( new InputStreamReader (istr) );
InputStream errorStr = proc.getErrorStream();
BufferedReader errorBr = new BufferedReader ( new InputStreamReader (errorStr) );
bw.write("scan case40.10.txt"); /* I am trying to input the scan command to the shell,but it is not working*/
bw.flush();
Vector list = new Vector (1) ;
String str;
while ( (str = br.readLine() ) != null) {
list.addElement(str);
} // End of while
Enumeration enumForList = list.elements();
while ( enumForList.hasMoreElements() ) {
String tempString;
tempString = ( String ) enumForList.nextElement();
System.out.println(tempString); // I am trying to read the outputs of the scan command but it is not reading (I can not see any output)
I tried with and without waitFor( ), it did not work
// wait for command to terminate
proc.waitFor();
// close streams
br.close();
bw.close();
errorBr.close();
} // End of try
catch ( IOException ioe ) {
JOptionPane.showMessageDialog (null, "Input / output error occured while compiling file ", "Error", JOptionPane.ERROR_MESSAGE);
} // End of catch
catch ( SecurityException se ) {
JOptionPane.showMessageDialog (null, "Security error occured while compiling file ", "Error", JOptionPane.ERROR_MESSAGE);
catch ( InterruptedException ie ) {
JOptionPane.showMessageDialog (null, "Interruption error occured while compiling file ", "Error", JOptionPane.ERROR_MESSAGE);
} // End of method compileFileMethod
// Thank you for your helps and time.You cannot invoke BAT files directly, you have to invoke the program that run those files which is your Windows 98 shell. For example (under windows 2000), i would invoke "cmd.exe sricpt.bat some args", rather than "script.bar some args".
Hope this will help you out. -
I face problems with the Nvidia 8800 GS on my iMac 24'' 3.06Ghz intel core duo. OS 10.06.08. What can I do to solve the problem and if you recommend upgrade to mountain Lion
If you want to sync it to the iPad from that Mac, you need to upgrade it to at least 10.5.8.
If you want to copy the music to another Mac, you don't. Move the iTunes folder of the item in the Finder's sidebar over as you would any other folder. If you put it somewhere other than the Music folder, launch iTunes with the Option key held down and point it to that location.
(61713) -
I have tried to install office for mac and an iWork trial and each time I go to install after downloading my "terminal" opens with the
heading
bash-80X24 and
in the box reads Joel$-office installer.mpkg joel$ .
nothing further happensThis is thread from Apple discussions.
Look for the suggestion from Shootist007 towards the end of the 2nd page.
It is just may be useful.
https://discussions.apple.com/thread/3709115?start=15&tstart=0 -
I had restored my iPhone 4 but after restore my camera can't function well after take picture from the camera it's didn't display in the Photo Gallery even can't take a video record,how to solve this?and i had tried to restore again,still the same
kindly reply and fix this for me
reply to my email,tqMost likely you have Office 2004 which are PPC-only applications and will not work in Lion. Upgrade to Office 2011. Other alternatives are:
Apple's iWork suite (Pages, Numbers, and Keynote.)
Open Office (Office 2007-like suite compatible with OS X.)
NeoOffice (similar to Open Office.)
LibreOffice (a new direction for the Open Office suite.) -
[SOLVED] Arch64, Opera and plugins library problem
I have Arch64 with Opera 64-bit as default browser. I have succesfully installed 32-bit flashplugin and it works nicely. The only problem is that fonts cannot be read from the flash player context menu and Open File dialog opened from flash player. The problem is that flashplugin tries to load 64-bit GTK from /usr/lib/gtk-2.0/2.10.0/ and it fails. 32-bit version is installed and it's located in /opt/lib32/usr/lib/gtk-2.0/2.10.0/.
Gtk-WARNING **: /usr/lib/gtk-2.0/2.10.0/engines/libmurrine.so: wrong ELF class: ELFCLASS64
Gtk-WARNING **: /usr/lib/gtk-2.0/2.10.0/engines/libpixmap.so: wrong ELF class: ELFCLASS64
Also I have library loading problem with totem-plugin. It cannot find libxul.so and libxpcom.so, but both library files are located in /usr/lib/xulrunner-1.9.0.1/. The plugin loads fine if I create links to both files in /usr/lib/. But that doesn't seem like right solution to me.
$ ldd libtotem-mully-plugin.so
libglib-2.0.so.0 => /usr/lib/libglib-2.0.so.0 (0x00007f94e19d9000)
libtotem-plparser-mini.so.10 => /usr/lib/libtotem-plparser-mini.so.10 (0x00007f94e17d6000)
libxul.so => not found
libxpcom.so => not found
libplds4.so => /usr/lib/libplds4.so (0x00007f94e15d2000)
What would be a most elegant way of solving these two library loading problems?
I think that symbolic links and moving files are not the most elegant way to solve the problem. Maybe some environment variable or some configuration setting would solve the problem (LDPATH comes to mind, but it seems that it doesn't work).
EDIT: I wasn't sure in which section to post this question, so feel free to move it if necessary.
Last edited by SnapShot (2008-09-12 02:50:01)I have solved my problem and I will post my solution because it can be usefull to others.
First the problem with flashplugin and GTK library path. Opera uses operapluginwrapper scirpt to detect if the plugin is 32-bit or 64-bit and after detection it uses operapluiginwrapper-ia32-linux for 32-bit or operapluginwrapper-native for 64-bit plugins. operapluiginwrapper-ia32-linux loads the 32-bit flashplugin in my case which requires GTK, but it incorectly tries to load it form /usr/lib/gtk-2.0/ where 64-bit version of GTK resides.
The solution is to set the GTK_PATH environment variable to point to /opt/lib32/usr/lib/gtk-2.0/ where 32-bit version resides. But if you set it globaly it will result in problems with other 64-bit applications. So the correct solution is to add following lines on the bottom of the operapluginwrapper script above the exec line:
case "$wrapper" in
*ia32*)
export GTK_PATH="/opt/lib32/usr/lib/gtk-2.0"
export PANGO_RC_FILE="/opt/lib32/config/pango/pangorc"
esac
In this way the 32-bit paths will be active only for operapluginwrapper-ia32-linux process.
I have solved the other problem with totem-plugin requesting libxul.so and libxpcom.so, but the solution idoesn't matter because, although totem-plugin loads coreclty it doesn't work in opera. I have installed mplayer-plugin which works as it should. Also gecko-mediaplayer works correctly with opera, I have tested them both. Install one of the two plugins that work, and you will be fine. -
[SOLVED] Bash coloured prompt issues
Hi, I'm having trouble with my bash prompt and after going through a sea of posts on prompts I can't seem to figure out why mine isn't giving the desired behaviour.
YELLOW='\[\e[0;33m'
WHITEBOLD='\[\e[1;37m'
WHITE='\[\e[0;37m'
ORANGE='\[\e[1;31m'
PS1="${WHITE}[${ORANGE}\u\] ${YELLOW}\@\] ${WHITEBOLD}\$(parse_git_branch)\] ${ORANGE}>\] ${YELLOW}\w\]${WHITE}]\] \$"
The desired output:
[will 06:48 PM (master) > ~/.vim] $
When I scroll through the history the prompt messes up and starts looking like this:
[will vim ~/.bashrc
Last edited by will.price94 (2012-02-27 21:02:26)The prompt counts your color sequences as characters which messes up the cursor position. Escape the ${WHITE} and ${YELLOW} etc. by putting them between \[ \] like this: \[${WHITE}\] . In your case, include the closing \] when you define the color variables, so
YELLOW='\[\e[0;33m\]' so you don't have to worry about them in the PS1= sequence.
Edit: try like this (maybe remove some spaces, haven't tried the prompt myself)
YELLOW='\[\e[0;33m\]'
WHITEBOLD='\[\e[1;37m\]'
WHITE='\[\e[0;37m\]'
ORANGE='\[\e[1;31m\]'
PS1="${WHITE}[${ORANGE}\u ${YELLOW}\@ ${WHITEBOLD}\$(parse_git_branch) ${ORANGE}> ${YELLOW}\w${WHITE}] \$"
Last edited by VCoolio (2012-02-27 20:26:34)
Maybe you are looking for
-
Installing Windows 7 - New Mac Mini no Optical Drive
Hello, I would like to install a Windows 7 on a new 2011 no optical disk mini. I am aware of how to do that, and what do I need to prepare, becouse there is not a optical disk in a mini. Any ideas on if I can buy (download) a Windows 7 from www.micro
-
NullPointerException in JDWP during HotSwap
I'm developing an application that needs to redefine classes at runtime, for which I'm using the HotSwap feature of the Sun JVM. I've written a HotSwap class that conects the application to itself via the SharedMemoryTransportService, obtains the Vir
-
MacBook blanks out when Resuming from Sleep
Hello. I am having a problem with my MacBook. If i have it closed and asleep for a little while (about 15 minutes or more) and i come back and open it up, the screen will come on as usual and i will see my desktop, but after about a second, my screen
-
I want to stop erase mode, pls help me?
hello, i want to stop erase mode, pls help me?
-
My battery died and shut down improperly and now my windows won't even start. I have a thinkpad edge less than a year old. I have tried safe mode, the recovery prompt, and the normal setup but it always leads me to a blank black screen with just my