The tag has no wiki summary.

learn more… | top users | synonyms

5
votes
1answer
594 views

Why do I have to escape a “dot” twice?

I know that we can escape a special character like *(){}$ with \ so as to be considered literals. For example \* or \$ But in case of . I have to do it twice, like \\. otherwise it is considered ...
2
votes
2answers
51 views

What is the problem with the output of plink?

On my Windows7 machine, I'm traversing to the installed path of PuTTy Application and running: plink <hostname> to connect to my remote Linux host. I see some unrecognized characters in the ...
3
votes
2answers
61 views

How to change font colors in terminal?

I know how to change the font color via preferences, but it changes the color of ALL text, as in below:     What I'm going for is something more like this:     Any ...
0
votes
1answer
203 views

Proper escaping of double quotations for curl post data?

I'm trying to test out a server, by sending it JSON data and reading the response. I need to POST data like {"item":"value with spaces"} but when I use curl I find that it sends the backslashes as ...
1
vote
1answer
41 views

is there a pastebin service that supports terminal escape sequences?

Is there a pastebin service that supports colors? I understand some of them have syntax hilighting, but I'd like to do arbitrary coloring, preferably using the terminal escape sequences. Example, i'd ...
1
vote
1answer
37 views

Proper use of escape characters in desktop file

I have a command with a working .desktop Exec key as follows: Exec=env XDG_CONFIG_HOME=/home/bean/.config/gedit/ gedit %U I would like to use the $HOME variable instead and it works in the terminal ...
1
vote
1answer
313 views

Exit of “> ” mode in Unix shell

In sh (not Bash), how would we abort execution of command when the prompt is in > mode? For example, when entering a string with quotes only at the beginning, it makes the prompt look like >, ...
1
vote
1answer
93 views

Cat and Less give different output

I executed the following command # top > /home/user/top_output.txt Nothing Happened for a while and then i pressed Ctrl+C. When i checked the file that was created, it had the contents in it. So ...
4
votes
2answers
1k views

Why does Ctrl-D (EOF) exit the shell?

Are you literally "ending a file" by inputting this escape sequence, i.e. is the interactive shell session is seen as a real file stream by the shell, like any other file stream? If so, which file? ...
3
votes
1answer
146 views

How to find out the escape sequence my keyboards sends to terminal?

Let's say we have a generic keyboard with some unknown keys which may send escape sequences to terminal. The keyboard is connected to an xterm terminal emulator running on a generic BSD/Linux. To ...
2
votes
2answers
112 views

Weird escape sequence

I need help identifying what this escape sequences represents. I see this sequence is autogenerating on my server's console, but I'm not sure what is the reason for that. Escape sequence: ^[[[D I've ...
3
votes
1answer
41 views

How do I generate the sequence “\e[Z” in a terminal?

It is bound to menu-complete in GNU readline. $ bind -p|grep menu "\e[Z": menu-complete # menu-complete-backward (not bound) # old-menu-complete (not bound) I think it's Meta-something.
3
votes
5answers
437 views

What are the special characters to print from a script to move the cursor?

I found that by printing \r from a script the cursor moves to the beginning of the line. What character will move the cursor up one line? Where is a list of these special characters? EDIT: Working ...
13
votes
4answers
637 views

Is there any reason why I get ^[[A when I press up arrow at the console login screen?

Whenever I'm at the console login, I press up arrow intentionally to see the previously typed commands. But I see this ^[[A. But when I press Ctrl Alt Print Screen Scroll Lock Pause Break Page Up ...
2
votes
1answer
130 views

Garbled text in tmux menus

I am trying to use the st terminal, but after starting tmux (or screen) in a remote ssh session, the text becomes all garbled. Exiting tmux/screen makes text normal again. Now, I have found that this ...
3
votes
0answers
156 views

How to create a bash command which creates output that exactly mimics a source text file that can be pasted into bash shell where histexpand is on?

The goal is to create a bash one line command that can be copied and pasted - for instance published on a web forum - and then patches files. See it as a way to distribute a patch file by copy and ...
2
votes
2answers
176 views

Maximize xterm via bash script

I have found this answer providing how to manipulate the current xterm window's dimensions, ie: echo -ne "\e[8;30;30t" How can I modify this to maximize the window (xterm's alt + enter shortcut)? ...
1
vote
5answers
178 views

Deleting all files that begins with parenthesis

I have many files in a directory that begins with parenthesis. They are generated by Dropbox due to conflict. Any combination of escaping does not seem to help: rm -rf "(*" rm -rf "\(*" rm -rf \(* ...
2
votes
1answer
104 views

What characters TAR doesn't like?

I keep a list of photos burned to dvds for incremental backups but I got into a strange situation where a file was already burned into a dvd but tar keeps saying it's not. Here the steps to reproduce: ...
1
vote
0answers
17 views

Using tput in $PS1 is breaking line wrapping [duplicate]

Good Morning- I'm trying to use tput outputs in my $PS1 to set the background color to red in the event I'm on a production server: if [[ `hostname -s` = prod-db ]]; then export ...
2
votes
2answers
525 views

\uFFFD character in directory name

I have a lot of directories with a \uFFFD (65533) character in it. The problem is that I can't really access this directory because of this character. For example I got a directory with the name: ...
4
votes
2answers
188 views

The difference between \e and ^[

Gilles wrote: character 27 = 033 = 0x1b = ^[ = \e Demizey wrote: ^[ is just a representation of ESCAPE and \e is interpreted as an actual ESCAPE character Then I also found this line from ...
6
votes
3answers
2k views

Escape sequences with “echo -e” in different shells

I just noticed that it seems like the flag -e does not exist for the echo command in my shell on Linux. Is this just a messed up setting or is it "normal"? Some code as an example: #!/bin/sh echo -e ...
2
votes
1answer
280 views

highlighting text in shell

I have always been using below method to highlight background of text in shell . tput smso;printf " TEXT ";tput rmso; How can I achieve the same thing without using tput( I mean some way formatting ...
2
votes
1answer
563 views

Visualizing ansi color escape codes in log files correctly in Emacs [duplicate]

I have some log files that have ansi-color codes in them. When I open them in Emacs I see garbage:           As an example, I run the following: ls --color=yes -ald -- * ...
1
vote
1answer
187 views

Cannot echo colored text when inserting in status bar in dwm

I'm using Fedora 18. I'm trying to create a custom status bar in dwm. Now what I'm thinking of is to check if the battery is under a certain level, the background of the battery region in the status ...
2
votes
1answer
114 views

Is it possible to get a character at terminal cursor using ANSI escape codes?

I know I can move the cursor with the escape codes, and I can also print at the cursor. What I'd like to know is if it is possible to pull the character under the cursor. I tried searching for such a ...
4
votes
3answers
2k views

Where do I find a list of terminal key codes to remap shortcuts in bash?

For example: "\e[1;5C" "\e[Z" "\e-1\C-i" I only know bits and pieces, like \e stands for escape and C- for Ctrl, but what are these numbers (1) and letters (Z)? What are the ;, [ and - signs for? ...
0
votes
1answer
68 views

can someone fix my PS1 for bash

I seem to have too many colour escapes so it only works in some prompts - can someone please correct for me ? PS1='\[\e[0:35m[\u@\e[0:33m\h\e[m \e[0:35m\w]\e[m \e[0:33m`git branch 2> /dev/null | ...
5
votes
2answers
2k views

Change colors in console/virtual terminal

Is there a way to alter all the available colors in console / virtual terminal? By console, I mean what you get after pressing CTRL + ALT + F1 and not anything like xterm or urxvt. So, I guess that ...
4
votes
5answers
271 views

How to use ' in alias?

I have one-line that I want to call using alias. while printf '%s ' "$(df -P / | awk 'NR==2 { print $(NF-1) }')"; do sleep 30; done I tried to escape ' like \' but it didn't work. What is the ...
3
votes
2answers
130 views

Can I make grep treat escaped multiline as a single line?

How can I make tools like grep treat multilines escaped with a backslash as a long single line? Let's say I have some files that looks like this: testvar=test1 \ test2 \ test3 ...
2
votes
2answers
818 views

Calling bash from sh (dash) with commands read from args, and “Unterminated quoted string”/“unexpected EOF”

Just thought I'd document this: I'm trying something very simple - set env variable in bash, and print it out: $ bash -c "a=1; echo a$a;" a $ bash -c "a=1; echo a\$a;" a1 Now I'd want this same ...
1
vote
2answers
161 views

How to print shell variables and values to be able to copy/paste them?

In Bash 4.2.25, the set and env output is not escaped, so shell escapes and any non-printable characters won't be copy-pasteable. Take for example this shell session: $ export foo=$'a\nbar=\baz' $ ...
0
votes
1answer
84 views

Colon breaks the variable subsitution [closed]

I am trying to lookup some C functions so that I could debug while using strace. So I setup a bash function to look it up in firefox (or links), but the substitution falls apart with : and escaping ...
0
votes
3answers
331 views

Can groff create a ps file with interpreted ANSI escape characters?

This question is inspired by this one on SU. How can I print bold or color using lp and ANSI escape sequences? I know how to display, for example, bold text in the terminal: $ echo -e ...
1
vote
2answers
298 views

How to escape text in awful.util.spawn_with_shell command?

Based on a suggestion, I've now got the following call in rc.lua: awful.util.spawn_with_shell('vlc $(xclip -o)') How do I ensure that the output of xclip is escaped so that space characters are not ...
1
vote
1answer
200 views

How to prevent double escaping?

I'm trying to put a bunch of images together into a pdf. I ran gm convert *.jpg out.pdf and it worked, but the images were not in the right order. I found that ls -v orders them correctly so then I ...
0
votes
1answer
58 views

What characters in my printed boot scroll are artifacts?

I am a tech writer and I need to include a boot dump in a document. The dump the engineers gave me has some "bad characters" that I need to delete. What form does a "bad character" take? There are ...
2
votes
1answer
110 views

How can a bash script detect support for window titling escape characters?

I have a debug trap that runs every time I enter a command in bash that sets the window title to indicate what command is running. I'm leaving out all the configuration details and boil it down to: ...
2
votes
1answer
150 views

Confused about when to escape metacharacters in pathnames

I'm pretty confused about under which circumstances do I need to escape metacharacters in pathnames. Consider the following example: I'm in the following working directory: $ echo $PWD ...
1
vote
2answers
349 views

Convert discus output into readable HTML mail

How can I take the DISCUS command output below: and convert it into something HTML email friendly? I've bash scripted something like this: #!/bin/sh discus > /tmp/discus.log touch ...
4
votes
1answer
87 views

how to escape “\”in ssh-copy-id?

I'm connected to Ubuntu server that is a member of a corporate Active Directory domain via likewise-open. The users are in the form mydomain\myuser. I can connect to it via ssh, escaping the \ with ...
5
votes
1answer
2k views

Trouble in script with spaces in filename

I've got a script that scp's a file from remote host back to local. Sometimes the file names contain spaces. scp does not like spaces in its file names. For some reason my attempts at handling the ...
2
votes
1answer
801 views

Shell escape characters for sh -c

I need to execute a command with escaped argument(s) using sh -c. I know the string looks pretty ugly but simple ones don't cause a problem. The output of the echo when passed to sh -c is different ...
2
votes
1answer
132 views

Graphical console applications in Emacs

I am having trouble running htop within an ansi-term in Emacs 24.2. It looks like some of the control characters are not interpreted correctly. I thought ansi-term was capable of handling font ...
1
vote
2answers
656 views

bash scripting - Any function to escape character?

I am trying to automate some of my stuff and facing a issue, the problem boils down to escaping the value that is being passed as a argument to the script. myScript.sh #!/bin/bash loadPatch -name ...
2
votes
1answer
267 views

How to capture text formatting in bash?

The following shell script works but removes colored formatting generated by rspec: #!/bin/bash OUTPUT=`rspec` echo "$OUTPUT" How to preserve the colors?
3
votes
1answer
460 views

Printing colored text using script

When I type below command in the shell I get the OUTPUT in green color. Command echo "\033[32mCONNECTING TO abpwrk\033[m"; Output(in green color) CONNECTING TO abpwrk But if I use the same ...
2
votes
1answer
2k views

Backspace, del, arrow keys not working with interactive programs in Tilda

I currently run Openbox on a light netinstall of Debian. In Tilda, when I use a program like nslookup or winexe, some of my keys do not work properly. Backspace generates ^? Up generates ^[[A ...