Sponsored Content
Full Discussion: C code in Bash?
Top Forums Shell Programming and Scripting C code in Bash? Post 302959079 by Corona688 on Wednesday 28th of October 2015 01:02:54 PM
Old 10-28-2015
It's nothing to do with C.

The -e, in some very specific versions of the bourne shell, means "enable escape sequences", including octal ones, of the form backslash-zero-digit-digit[-digit]. In most other versions of the Bourne shell, the -e and the backslashes and everything will be dumped literally. printf, though, does support these sequences almost everywhere.

The [91m bit has nothing to do with C or BASH. It just prints a literal [, 9, 1, m. But a terminal supporting ANSI escape sequences will take octal 33, followed by [, 9, 1, m, to mean "change color to bright red".

The 39m means 'switch back to grey', which is a little wrong, as the appropriate thing to do is a reset to default, not what you assume the default to be.

Last edited by Corona688; 10-28-2015 at 02:19 PM..
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Bash Source Code

Can somebody give me the link to get the source code of BASH? (1 Reply)
Discussion started by: bhargava
1 Replies

2. Shell Programming and Scripting

xml code in bash shell

Hi, I am trying to develop a bash script that contains an xml code. I want to put the xml code inside the bash script. Is there a way to make that happen?! My goal is to create a script that can allow the user to enter some parameters which can be passed by the script to the xml code :o . ... (2 Replies)
Discussion started by: the wonderer
2 Replies

3. UNIX for Dummies Questions & Answers

Code stripper for bash script..

Dear all, Is there any open source tool for stripping the comments to bash script without affecting the code part? Please give me any reference to it.. Thanks in Advance... (2 Replies)
Discussion started by: Nila
2 Replies

4. Shell Programming and Scripting

Help to write bash script code

I am newbie to UNIX. I came across this exercise in one the books.Can anyone help me with this question?????? Write a short Bash script that, given the name of a file as an argument, reads the file name and creates a new file containing only lines which consist of one word. Here is an example... (4 Replies)
Discussion started by: krthknaidu
4 Replies

5. Shell Programming and Scripting

What's wrong with my bash code?

I want to let sleep 3 in the background and echo $i pkglists="a b c d e f g" f() { local i set -- $pkglists && ((i +=2)) && sleep 3 &;echo $i } f (3 Replies)
Discussion started by: yanglei_fage
3 Replies

6. UNIX for Dummies Questions & Answers

Understanding bash code

I am not able to understand below line in unix bash shell.Could anyone explain what it will do result="${path1}/*${var1}*${var2}*wssreligibleitem*.csv" path1 is defined and it is a directory path var1 is defined and it holds string value like abc var2 is defined and it holds string value like... (6 Replies)
Discussion started by: vamsi.valiveti
6 Replies

7. Shell Programming and Scripting

Bash code will not run

Why doesn't the code below run? Am I missing something? Thank you :). syntax() { printf "\n\n" printf "Enter HGVS description of variant(s): "; IFS="," read -a hgvs && printf "\n Nothijng entered. Leaving match function." && sleep 2 && return for ((i=0;... (5 Replies)
Discussion started by: cmccabe
5 Replies

8. Shell Programming and Scripting

Bash code change

I have the below bash which runs great. Before I make a change I wanted to check with experts (as I am not one). After the perl code completes, I am going to display "annotation complete" then go into the remove function . annovar() { # combine id and position files cd... (2 Replies)
Discussion started by: cmccabe
2 Replies

9. Shell Programming and Scripting

Bash FPATH code update

In this post at 302451613-post2.html the link to the code comes up not found. The thread is closed, so I was unable to ask on the thread itself and I do not have enough posts yet to send a private message (or write out a proper html link). Does the author (jim mcanamara) have an updated link? ... (2 Replies)
Discussion started by: matthewpersico
2 Replies

10. Shell Programming and Scripting

bash - Validating return code 0

Hi All, I am trying a script out that will startup on one of my servers. i wanted to check for RC 0 and if it didnt check out, exit. Typo- This is BASH (Redhat) This isnt working, and this is the best way to do error checking I feel. Heres my erorr ./start: line 25: syntax error near... (2 Replies)
Discussion started by: jeffs42885
2 Replies
RESIZE(1)						      General Commands Manual							 RESIZE(1)

NAME
resize - set TERMCAP and terminal settings to current xterm window size SYNOPSIS
resize [ -u | -c ] [ -s [ row col ] ] DESCRIPTION
Resize prints a shell command for setting the TERM and TERMCAP environment variables to indicate the current size of xterm window from which the command is run. For this output to take effect, resize must either be evaluated as part of the command line (usually done with a shell alias or function) or else redirected to a file which can then be read in. From the C shell (usually known as /bin/csh), the follow- ing alias could be defined in the user's .cshrc: % alias rs 'set noglob; eval `resize`' After resizing the window, the user would type: % rs Users of versions of the Bourne shell (usually known as /bin/sh) that don't have command functions will need to send the output to a tempo- rary file and the read it back in with the ``.'' command: $ resize > /tmp/out $ . /tmp/out OPTIONS
The following options may be used with resize: -u This option indicates that Bourne shell commands should be generated even if the user's current shell isn't /bin/sh. -c This option indicates that C shell commands should be generated even if the user's current shell isn't /bin/csh. -s [rows columns] This option indicates that Sun console escape sequences will be used instead of the VT100-style xterm escape codes. If rows and columns are given, resize will ask the xterm to resize itself. However, the window manager may choose to disallow the change. Note that the Sun console escape sequences are recognized by XFree86 xterm and by dtterm. The resize program may be installed as sunsize, which causes makes it assume the -s option. The rows and columns arguments must appear last; though they are normally associated with the -s option, they are parsed sepa- rately. FILES
/etc/termcap for the base termcap entry to modify. ~/.cshrc user's alias for the command. SEE ALSO
csh(1), tset(1), xterm(1) AUTHORS
Mark Vandevoorde (MIT-Athena), Edward Moy (Berkeley) Copyright (c) 1984, 1985 by X Consortium See X() for a complete copyright notice. X Window System RESIZE(1)
All times are GMT -4. The time now is 01:37 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy