General :: Echo Newline Character Not Working In Bash?

Mar 11, 2011

I have bash script which has lots of echo statements and also I aliased echo to echo -e both in .bash_profile and .bashrc, so that new lines are printed properly for a statement like echo 'Hello World' the output should be I even tried using shopt -s expand_aliases in the script, I am running my script as bash /scripts/; if I run it as . /scripts/ I am getting the desired output.

View 4 Replies


General :: Echo Text With New Line In Bash?

Jun 21, 2010

I would like to append text to a file. so i wrote in bashecho text >> file.confHowever it doesnt leave a new line. So i can only do this once. How do i add a new line?

View 2 Replies View Related

General :: Bash : Echo Arrow Keys?

Aug 12, 2010

Is it possible to echo the arrow keys (up, down, left, right) in bash?

View 4 Replies View Related

General :: Use The Man / Info / Apropos Pages - Character Instructed The Shell To Interpret A Special Character As An Ordinary Character?

Mar 27, 2010

1.What character instructd the shell to interpret a special character as an ordinary character?

2.What directory contains some of the utilities available on the system in the form of binary files?

3. What command is used to search the location of a utility?

4. What command is used to instruct the editor to write the file and quit the editor?

5. What key quits the more utility and displays the shell prompt?

6. What command starts a child shell as the super user, taking on root's identity and environment?

7. Which wildcard characters can be used for searching all the files in the system that start with "A"?

8. The user name or login name of the super user is????


View 10 Replies View Related

Programming :: Bash If *sometimes* Fails To Detect Embedded Newline

May 21, 2011

Using xsel I pass a selection into a variable. I then check that the variable includes an embedded newline to be sure that the selection returned by xsel is complete. If the selection content preceding the newline is just a single word, the check fails to detect the newline, thus


g fnm=`xsel`
g cat <<< "$fnm"
apropos sear


View 14 Replies View Related

General :: How To Handle Character In Bash Shell

Apr 30, 2011

i have a script where i need to pass an argument "1234:-)"if i run this as ./ 1234:-)it wont work because invalid character. i need to handle this with expect utility so if i pass it as ./ "1234:-)"no issue in bash but expect does not recognize this.

View 7 Replies View Related

General :: Xargs CD Not Working (Echo Some Directory)

Mar 18, 2010

Please explain why
echo some_directory | xargs cd
is not working.
echo some_directory | xargs ls
is working as expected.

View 14 Replies View Related

Software :: Dpkg - Add / Remove Package Won't Work - Terminal Goes: Bash Syntax Error Near Unexpected Token `newline'

Mar 11, 2010

When I am adding removing packages to get more hard drive space, this is not the first time I left too many pages open and it crashes on me. My son would fix it by typing in the terminal sudo something, but I want to know how to do this. The only thing not working is the add/remove packages at the moment. Here is what it said, E:dpkg was interrupted you must manually run 'dpkg--configure -a' to correct the problem E: _cache-open()failed please report. Please, could someone tell me how to get the default back or whatever. When I type in the terminal, it refused my password until I tried several times, plus, it finally says in the terminal No such command. Bash. No such command. I am hoping this question is one you do recognize the answer for.

I tried using Yum to remove the package. Like this:

To remove or uninstall a package:


yum -y remove ,package name>

Terminal goes: Bash syntax error near unexpected token `newline'

View 3 Replies View Related

General :: $echo Cat Vs $cat Echo / Difference Between Them?

Dec 16, 2010

What is the difference between

$echo cat
$cat echo

View 1 Replies View Related

Software :: Replace Newline Pattern In File By Other Newline Pattern In A Shell Script?

Nov 22, 2010

I have several (vhdl) files containing a pattern with newline characters that I need to replace by another pattern that also contains newline characters.

I start with something like:


I want to replace it by something like:


(I need to paste some lines)

As I need to do this (very) often I want to use a shell script.

I tried:








File remains unchanged








Displays the unchanged testfile

How I can automate the pattern replacement?


View 9 Replies View Related

Red Hat / Fedora :: Bash - Echo Multiple Numeric Values On One Line

Aug 9, 2009

I'm trying to get multiple numeric valued version information into a variable, all on the same line. I want for example $VERSION= I'm trying to pull seperate values from the file named, wherein the file contains;


So I have the following script:

PATCH=`grep "patch.rel.num" ${BUILDVERFILE} | awk {'print $1'}`
SQA=`grep "sqa.num" ${BUILDVERFILE} | awk {'print $1'}`
MAJOR=`grep "major.rel.num" ${BUILDVERFILE} | awk {'print $1'}`
BUILD=`grep "build.num" ${BUILDVERFILE} | awk {'print $1'}`
MINOR=`grep "minor.rel.num" ${BUILDVERFILE} | awk {'print $1'}`

P=`echo $PATCH | tr -d .=[:alpha:]`
S=`echo $SQA | tr -d .=[:alpha:]`
MA=`echo $MAJOR | tr -d .=[:alpha:]`
B=`echo $BUILD | tr -d .=[:alpha:]`
MI=`echo $MINOR | tr -d .=[:alpha:]`

echo $VERSION #

I end up with the value of .002 ?? Seems like it's only getting the last portion because if I run the script thru "bash -x" I get:
+ echo $'3

View 7 Replies View Related

Ubuntu :: Create New Directory But Keep Getting Same Error - Bash: Syntax Error Near Unexpected Token `newline'

Jan 13, 2010

I'm trying to create a new directory using the mkdir command.


home@ubuntu:~$ mkdir <aicoursework>
bash: syntax error near unexpected token `newline'

that's the error that i keep getting, what am i doing wrong?

View 5 Replies View Related

General :: Bash Scripting - Sed - Lame - Character To Lame To Escape Spaces

Mar 20, 2010

Ok, so I find myself ripping audio CDs frequently, which I then lame to mp3's to put on my media player. I usually define the --ta and --tl (artist and album) ID3 tags and batch encode each album, but don't bother with the track tags as I'd have to do each one seperately.

So, I'm working on a script to do all this for me, extracting info from 'pwd' etc. to fill in the blanks for --ta, --tl and --tt (track name). All is working well, except that I can't get sed to pass on the "" character to lame to escape spaces.

Here's what I've got so far: (trouble spot is bolded - no need to pay attention to the rest of it)


All this does is pass a 'space' on to lame, which it takes as an invalid argument.

View 10 Replies View Related

General :: Running Bash But Common Bash Commands Not Working?

Jul 17, 2010

below are the details of my system. I have bash as my current shell, some really common commands aren't working.

Do I need to do a re-installation of bash? Or how do I install a selection of bash commands which I need? (for example a subset of [URL])

root@sdptfw:~ # uname -a
Linux 2.4.36 #1 Tue Jul 22 13:13:24 GMT 2008 i686 i686 i386 GNU/Linux
root@sdptfw:~ # echo $SHELL$


View 13 Replies View Related

Ubuntu :: Bash No Longer Supports The Character?

Mar 25, 2011

A very strange problem started for me today. I SSHed into a server and could not type the letter 'i'. It would work fine if I was not in an SSH session, but consistently and repeatedly broke when I started SSH. I rebooted my machine, and the problem now occurs any time I'm using Bash, whether SSHing or not. For the record, I'm doing all this in the standard gnome-terminal.

First: it is not a problem with my keyboard. As you can see, I am perfectly capable of typing the letter 'i' in a browser window. In fact, capital 'I' works fine in bash as well. If I start nano from Bash, I can type the letter 'i' all day long, but when I exit to the Bash prompt, again I am unable to.

What's even more bizarre, I cannot even paste the letter 'i' into bash, either via Ctrl+Shift+v or by middle mouse clicking. This makes it impossible for me to type commands like 'vim' or 'exit'. Bash scripts, however, appear to have no problem with this particular character. Now, I've commented everything out of my .bashrc file, but that didn't help. I got rid of my custom .xmodmaprc file. Still nothing. Keyboard layout is U.S. English. I removed all Keyboard Shortcuts that involve the letter 'i'. Rebooted half a dozen times, still no luck.

My workaround at present is to use zsh instead of bash. Everything works fine with it, but I'd really like to get this thing fixed.

View 4 Replies View Related

Programming :: BASH Script: Spaces Are Getting Converted To TAB Character?

Dec 23, 2010

I have a BASH shell script with embedded SQL script. The SQL script fetches the data from oracle server and the data contains more than 8 spaces in the value (eg, 28051630 A) and the data is written to flat file using the below syntax:

$ORACLE_HOME/bin/sqlplus -s ${CONNECT_STRING} >${out_file} <<!!
.. sql query..

The problem is that whenever the data is written to ${out_file} spaces are getting converted to TAB character

eg, 10 spaces (in Oracle) converted to 1 TAB and 2 spaces 7 spaces (in Oracle) converted to 1 TAB and 1 space Also, from above example you can see the width of TAB char is not constant (8 in first example and 6 in second example) Is there any way that I can stop shell script to convert spaces into TAB character as I want the data as it is from Oracle DB (i.e. only spaces not TABs)

View 3 Replies View Related

Programming :: Bash Scripting - Parsing Text File By Character

Aug 11, 2009

Is there a way to process individual characters one-by-one from a text file in Bash, or is that hoping for a little too much from this lovable old clunker?

View 13 Replies View Related

OpenSUSE :: 11.3 Kde4 - Prevent Konsole/htop/bash To Use Bold Character?

Aug 9, 2010

As exposed in a previous thread : 11.3 64b nvidia kde4 : font color bug in konsole I have a problem in the konsole terminal . I chose the Fixed [misc] font and i want the size 3. But for some unknown reasons konsole wants to display some chracaters and some words in bold . As This font doesn't exist in size 3 in bold, it displays the bold characters in size 7, which is the smallest available bold size for this font set (Fixed [Misc]) . It makes any of these bold characters unreadable as they are too large compared to the room they have to be displayed. How can i prevent konsole , bash , htop or any program responsible for this behaviour, to display such bold character ?

View 3 Replies View Related

General :: Where Did The Trailing Newline Characters Go

Aug 11, 2011

I am working with bash scripting and running into a weird issue where the trailing newline characters are being truncated.The file contents are something like:

# Catting the file shows the trailing
cat /tmp/junk
first line
second line


Since I am working with config files, some of the applications/daemons fail to start if they fail to find trailing newline characters

View 4 Replies View Related

General :: Remove <br> Html Tag And Replace With Newline

Dec 2, 2009

I've been playing around with sed but can't find a way to remove the <br> html tag and replace it with a newline. Sed isn't truly needed awk or other suggestions could be good.

View 3 Replies View Related

General :: Concatenating 2 Files Without Creating Newline Between Them?

Dec 23, 2010

Concatenating two files without creating a newline between them? So how is it possible to do that? I've tried the following:
echo 123 > file1
echo 456 > file2
cat file2 file2 > file3


View 8 Replies View Related

General :: Get The Ubutnu Version Of Mana World - Missing A Newline

Jan 9, 2010

I have a dell mini 10v with ubuntu. I have been trying reapteadly to try to get the ubutnu version of mana world on my laptop but it always says its missing a newline. Because i download the game from my synapic manager and it says its missing final newline.

View 8 Replies View Related

General :: Writing In Bash While It Is Working?

May 6, 2011

When you are performing time consuming operations in bash like installing new software, is it possible to write text that will appear at the prompt when the operation has finished.


Imagine running:

apt-get install eclipse-platform

Then it will use quite a while to finish while you see the installation log, meanwhile I want to create new folders (workspaces) which Eclipse later will use.

Is this possible without opening a new terminal (or tab)?

View 5 Replies View Related

General :: Scp Is Not Working With Restrict Bash?

Apr 21, 2011

I just wondering if scp working with restrict bash ? It seems like my scp just stuck there while login.

If i use ftp i get 530 login failed..

View 1 Replies View Related

General :: Bash For Loop Not Working?

Apr 21, 2010

I have bash 4.0. I used the following for loop example, but all it outputs is "{1..10} instead of the actual numbers one through ten. why?

for a in {1..10}
echo -n "$a "

View 5 Replies View Related

General :: Error Propagation Not Working In Bash

Mar 14, 2011

when ever some error happens in the functions, they are not propagated and err_out function is not called.I tried #!/bin/bash -E too; that way when there is an error the script exits but what I need is error to be propagated properly to the handler.

View 1 Replies View Related

General :: Echo An '-n' Without A New Line?

Oct 19, 2010

how to echo an '-n' without a new line?

View 8 Replies View Related

General :: Removing Subdirectorys And Only Working With Files (Bash Cookbook 5.8)?

Jul 6, 2010

The Cookbook gives us

for FN in $*
echo changing %FN
chmod 0750

but that changes all. how can I change all files but subdirectorys? I was thinking of something likels -l | grep -v ^d but can't get it to work. I'm still learning about variables and how to use them. thanks in advance for your Patients.

View 2 Replies View Related

General :: Bash History And Keeping Track Of Current Working Directory?

Jun 8, 2010

I would like to keep track of not only what bash commands I used and when, but also where they were issued from, i.e. what was the current working directory when I issued "foobar" on a particular day and time. Can we ask bash history to keep track of working directories too? I have tried to get an idea of this reading the enormous "man bash", but I don't seem to have an answer yet either way.

View 11 Replies View Related

General :: Cd Command Not Working In .cshrc File (bash Shell SUSE)?

May 29, 2011

Just trying to execute cd command in a .cshrc file (bash shell in SUSE Linux) it says."No such file or directory".Do you see any reasons for this

View 3 Replies View Related

Copyrights 2005-15, All rights reserved