Sponsored Content
Top Forums Shell Programming and Scripting Remove ^? characters in shell variables on using backspace Post 302613573 by sachinverma on Tuesday 27th of March 2012 12:31:23 PM
Old 03-27-2012
Bug Remove ^? characters in shell variables on using backspace

Friends,
I observed a peculiar problem in shell.

if I set a variable using standard input and backspace was used by the user, then the variable get ^? characters embedded in the variable.

###
echo "Enter value for X="
read X
echo $X
expr $X + 1
###
If the variable is echoed, then there is no problem but if I try to perform any mathematical operation say addition then it displays an error like "123^?^?^?23" integer expected.
How can I supress these symbols so that the expr command does not fail.


Please help...
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Perl script backspace not working for Unicode characters

Hello, My Perl script reads input from stdin and prints it out to stdout. After I read input I use BACKSPACE to erase characters. However BACKSPACE does not work with Unicode characters that are multi-bytes. On screen the character is erased but underneath only one byte is deleted instead of all... (3 Replies)
Discussion started by: tdw
3 Replies

2. Shell Programming and Scripting

Help with checking that 2 variables contain matching characters

hi i am writing a hangman script and am having trouble checking the correct letters against the word i need the script to compare the word against the letters guessed that are correct so once all the letters within the word have been guessed it will alow me to create a wining senario eg ... (3 Replies)
Discussion started by: lsecer
3 Replies

3. Homework & Coursework Questions

Check 2 variables for matching characters

hi i am writing a hangman script and am having trouble checking the correct letters against the word i need the script to compare the word against the letters guessed that are correct so once all the letters within the word have been guessed it will alow me to create a wining senario this must... (1 Reply)
Discussion started by: lsecer
1 Replies

4. UNIX for Dummies Questions & Answers

Comparing the characters of 2 variables

hi i am writing a hangman script and am having trouble checking the correct letters against the word i need the script to compare the word against the letters guessed that are correct so once all the letters within the word have been guessed it will alow me to create a wining senario eg ... (13 Replies)
Discussion started by: lsecer
13 Replies

5. Shell Programming and Scripting

Want to remove the last characters from each row of csv using shell script

Hi, I've a csv file seperated by '|' from which I'm trying to remove the excess '|' characters more than the existing fields. My CSV looks like as below. HRLOAD|Service|AddChange|EN PERSONID|STATUS|LASTNAME|FIRSTNAME|ITDCLIENTUSERID|ADDRESSLINE1 10000001|ACTIVE|Testazar1|Testore1|20041|||... (24 Replies)
Discussion started by: rajak.net
24 Replies

6. Shell Programming and Scripting

Reading control characters into variables

Hi, I am trying to write a shell script to help with some digital signature work currently being undertaken where we have a file that contains a number of rows ending with ^M. What I need to do is concatenate this using shell scripting and retain the control character. E.G. abc^M... (5 Replies)
Discussion started by: chris01010
5 Replies

7. Shell Programming and Scripting

Working with lines or variables that have spaces or special characters

Example: while read line do stat -c %G $line done < somefile.txtThe problem is that inside somefile.txt lines can have any symbol allowed as file name, like (). Even with spaces, it splits the words. somefile.txt:dira/my first jump.avi dirb/surf video (1080p).mkv (2 Replies)
Discussion started by: Tribe
2 Replies

8. Shell Programming and Scripting

Remove first 2 characters and last two characters of each line

here's what im trying to do. i have a file containing lines similar to this: data.txt: 1hsRmRsbHRiSFZNTTA1dlEyMWFkbU5wUW5CSlIyeDFTVU5SYjJOSFRuWmpia0ZuWXpKV2FHTnRU 1lKUnpWMldrZFZaMG95V25oYQpSelEyWTBka2QyRklhSHBrUjA1b1kwUkJkd3BOVXpWM1lVaG5k... (5 Replies)
Discussion started by: SkySmart
5 Replies

9. Shell Programming and Scripting

ksh hidden characters in variables

Hi. I'm getting the following hidden characters \uat the start of a string after I pass in variables from the command line. I only noticed this when I set -x in my KSH script. Can anybody tell me how this happens and how to remove them? Many thanks. + STR=$'\uusername testuser1' + print... (12 Replies)
Discussion started by: user052009
12 Replies

10. UNIX for Beginners Questions & Answers

How to have local shell variables in a ksh script seen on remove server in SSH block?

I have googled this and found many solutions, but none of them are working for me. I am in a korn shell, most others reference bsh, maybe that is the issue? Anyway, all I am trying to do is use a variable I have declared in my main script in a remote shell I am running through ssh. So I have a... (8 Replies)
Discussion started by: DJR
8 Replies
BSFILT(1)						      General Commands Manual							 BSFILT(1)

NAME
bsfilt, colcrt - a colcrt-like backspace filter SYNOPSIS
bsfilt [ - ] [ -U ] [ file ... ] DESCRIPTION
Bsfilt filters backspace sequences from the input file(s) (standard input if none) in an approximation of colcrt(1). Both the backspace and the character it returns to are removed, unless they form an underline sequence. Underline sequences are treated according to the set- tings of the - and -U options. OPTIONS
- specifies that no underlining of any kind is to be propagated. Without this option or the -U option, bsfilt approximates underlin- ing with minus signs (`-') in following lines. -U specifies that underlining with underscore (`_') and backspace (`) character sequences is permitted. SEE ALSO
cawf(1), colcrt(1) and nroff(1). DIAGNOSTICS
Diagnostic messages are delivered to the standard error file. HISTORY
Vic Abell of Purdue University wrote bsfilt to have a backspace filter for cawf(1) that is independent of licensed source code. BUGS
The maximum length of a line that can be underlined with minus signs is fixed. Bsfilt does not examine the characters that are being overprinted via backspace operations. Thus, overprinting that is intended to form a new character from several different ones is ineffective and only the last character of the sequence is propagated - e. g., ``o^H+'', intended to look like a bullet, is reduced to `+'. February, 1991 BSFILT(1)
All times are GMT -4. The time now is 05:14 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy