Programming :: Echo Some Value Using Awk?

Jun 17, 2009

I am trying to echo some value using awk, and for reading the file i am using cat command. If there no space in the file content then the following script result correctly.

console: # cat 1
one;two;three;
four;five;six;

[code]....

In case any space is there in the file 1 then i am facing the problem in the output value

console: # cat 1
o ne;two;three;
four;five;six;

[code]....

View 5 Replies


ADVERTISEMENT

Programming :: What Exactly Does Echo $0 Return

Jan 18, 2010

I'm confused about what "echo $0" in a shell actually return. Consider these tests:

Code:
[root@e11apvl151 ~]# # Login shell:
[root@e11apvl151 ~]# echo $0
-bash
[root@e11apvl151 ~]# # Starting a new shell
[root@e11apvl151 ~]# bash
[root@e11apvl151 ~]# echo $0
bash
[root@e11apvl151 ~]# screen
[root@e11apvl151 ~]# echo $0
/bin/bash

Depending on wether the shell is a login shell, a regular shell, or a screen utility, I get different results.

View 8 Replies View Related

Programming :: Echo Hello Command Does Not Return

Jan 11, 2010

I am testing the serial ports on a Single Board Computer(SBC) running Linux kernel 2.6.29. I usually do this by connecting the serial port to another PC serial port, then doing "cat /dev/ttyS0" on PC and "echo hello > /dev/ttyS0" on the SBC. However in the current system, "echo hello > /dev/ttyS0" command does not return at all! Also no characters appear on the destination port. I am running the echo command as root. The system boot messages show that the serial port in indeed /dev/ttyS0.

View 2 Replies View Related

Programming :: Prevent Echo As Return Value?

Jan 25, 2010

I have always encountered this problem in ubuntu bash shell scripts that echo command in a function will be treated as a return value when used in a function. e.g.

[code]...

The output would simply be xyz. Hence the echo seems to function as a "return" command when used in a function with a return value.

View 4 Replies View Related

Programming :: Difference Between PHP Echo() And Print()?

Dec 1, 2010

What's the difference between PHP echo() and PHP print(), especially in the execution time?

View 6 Replies View Related

Programming :: Echo Two Command Output In The Same Line?

Jan 25, 2011

I try to write script and echo two command at the same line .

echo "A"
echo "B"

How can I pipe above two command at the same line in text file . So, in the output text file , you can see below ? Code: A B not Code: A B

View 4 Replies View Related

Programming :: EPOLL Echo Server Not Concurrent?

Feb 16, 2011

I am working on an epoll version of an echoserver that I am porting from a multithreaded version I wrote.What it should do: The server should get a connection from a client > say x client connected > print x message from said client. What it is doing: The server looks like it is only accepting one connection at a time, and any other clients are queued. When the queue is empty it looks like the program is aborting with a SIGABRT. EDIT:// fixed the program exiting in the close function. Still one client at a time

Code:
#include <assert.h>
#include <errno.h>
#include <fcntl.h>
#include <netinet/in.h>
#include <stdio.h>
#include <stdlib.h>

[Code]...

View 5 Replies View Related

Programming :: Need Exploit Codes For An Echo Program In C?

Mar 13, 2011

I am a student taking part in a comptition. We have a set of questions to complete within today. Can anyone please help me out with it. I have a custom written "echo" program in C, running on port number "1220" which echoes back the first 16 characters of whatever is given as the first command line argument. But somehow, my brother had got unauthorized remote root access. The program is given below. How did he do it? Please give the exploit code and explain how it works.

#include
#include
void echo(char* input) {

[code]....

View 2 Replies View Related

Programming :: Use Echo To Display The Content Of A Variable?

Jan 4, 2010

I have a problem to use echo to display the content of a variable.

This is what I do:

Code:
#!/bin/bash
USAGE="Usage: name [OPTIONS] [DIRECTORIES]"
echo $USAGE

When I run this little script I get the following output:

Usage: name [OPTIONS] R

So I think that [DI might be some sort of escape sequence. But I do not know how to unescape it. Does anyone have a hint for me?

View 14 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

Programming :: Script For Updates - Echo "update Failed"

Jul 27, 2010

I am trying to automate yum update of specific package on a remote machine. Essentially, the script executes, does a yum update, if not needed it would return echo result "update successful", if it needs the update and it installs it without error, it will return echo result "update successful", or if it fails the update it would echo "update failed". So far I have this:

[code]...

This is OK, but I NEED it to just return the final echo "Update successful". I can't have all the other lines. How can I do this?

View 2 Replies View Related

Ubuntu :: Playing With Tty And Pty (echo And Cat)?

May 11, 2010

I've read a bit about pseudo terminal but I still don't get it fully, I've found a really sweet article:

[URL]

I thought the two end tty and pty were acting like a pipe so while testing, I opened two terminals:

terminal1: cat /dev/ptyq9
terminal2: echo "test" > /dev/ttyq9

And it worked, terminal 1 printed: "test". But if the pipe is bi-directionnal ( as terminal were echoed back what user was typing), I was expecting to be able to go the other way around:

terminal1: cat /dev/ttyq9
terminal2: echo "test" > /dev/ptyq9

It does not work ! Echoing on pty just terminates the cat on pty. How is the "return" working them ?

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

Debian :: Can Record But Can't Echo Input

Jun 28, 2015

I can play audio in my alsa system and I can record. To keep things simple, I use arecord to record and aplay to play. So far so good. The problem is, I cannot hear what I am recording as I record it. Is there some way to get the input to be echoed to the output? I would optimally like to be able to do this before recording as well as during, so that I can check the levels, find the part to record on the tape, beforehand.

I have tried a test of my card: I had aplay running in one term and arecord running in another. They both ran fine and when I checked the just-recorded file, it was different audio from what I had been playing. This would indicate that the card is able to input and output at the same time, I think? I've done the usual googling as well as reading through URL... and I have done many passes of trial-and-error on my .asoundrc. The more I look at my .asoundrc, the more it looks like it should be doing what I want, but it is not.

My .asoundrc (which again, does works but does not echo audio input):
Code: Select all# pros: this allows playback and record.  Playback of several
# programs at the same time works (their outputs are mixed
# together, mono and stereo mixed to stereo)
#
# cons: input is never echoed!

[code]....

View 1 Replies View Related

General :: How To Echo Redirected Stdin

Sep 26, 2010

I execute an application from a script file and redirect stdin to it from here-doc like this:

my_cli << HERE_DOC
enable
configure
10
exit
exit
HERE_DOC

This works as expected, but I don't see neither the input nor the app output. The application is an interactive prompt written in C. When I interact manually with it, I see the prompt itself and responses to my input, but when I execute the aforementioned script I see nothing. I would like it to print the input and the output as if a real user was typing. Do you know how to achieve that?

View 3 Replies View Related

General :: How To Echo The File To Stdout

Sep 26, 2010

I have a process which logs output to log.txt. If I want to see the process's status in real-time, is there a way to echo that output to stdout instead of opening the log in a text editor and constantly reloading?

View 3 Replies View Related

Ubuntu :: Returns 0 To The Shell And Echo $? Gives 0?

Sep 1, 2010

check the following program
/*a.c*/
int main()

[code]....

View 1 Replies View Related

Ubuntu :: Echo Password When Entering In Rar?

Dec 28, 2010

When I use rar e to extract a rar file, the request for entry of the password always says password will not be echoed. For longer passwords, this is difficult, since a single mistyped key will result in an error.

Does anyone know how I can use the rar command to extract and have the password echoed (appear on the screen as I type it)?

View 2 Replies View Related

General :: What Does Echo $$ Give As Output

Nov 28, 2010

What does echo $$ give as output?

View 3 Replies View Related

General :: Echo Function In .bashrc?

Feb 25, 2010

I'd like a function in my .bashrc file that would allow me to pass text to it and echo the text to a specified file. I know it's simple as "echo 'text' >> file," but ideally, I would want to alias the function so I execute something like:

Code:
user~ $ write 'this is a test' with "write" being the function, and 'this is a test' being echoed to the file. I hope I explained that well enough.

View 3 Replies View Related

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 :: Use The -ne Flag For Echo In A Shell Script?

Jun 21, 2011

I'm trying to create a shell script to take an argument and use it to name a terminal tab. So if the script's name is tabnm, tabnm "test" should rename the current tab "test"

This is my code:

#!/bin/sh
echo -ne "e]1;$1a"

but when i run it I get this output:

robin@icarus $ sh tabnm.sh test
-ne e]1;test

If I just run echo -ne "e]1;Testa" straight in the shell, the tab is renamed.

View 2 Replies View Related

Ubuntu :: Right Padding In Echo Of Shell Script?

Mar 22, 2010

I'm a n00b in shell scripting,echo "$num $den $file" is the current formatI need 10 right padding for each term above in the above where $num & $den is of %d type, whereas $file is %s type.

View 2 Replies View Related

Ubuntu :: Echo Command To Output First Argument

Nov 5, 2010

In a script, when I enter "echo $1" the first argument is outputted. When I enter:
a=1
echo "$$a"

The output is just "$1", not the first argument. If I enter:
a=1
b=$$a
echo $b

The output is still "$1" and not the first argument. How can I get echo to output the first argument without use "$1" directly?

View 4 Replies View Related

Ubuntu :: Startup Scripts / How To Echo To Screen

Feb 2, 2011

I have ubuntu desktop 10.10. I wrote a simple script that I want to execute at system startup. The only problem I have (and one that I've been struggling with for the better part of the day) is that I don't see the outputs of the script during startup.

View 1 Replies View Related

Ubuntu Multimedia :: Audacity Pre-echo Removal?

May 15, 2011

I was using a line device to record compact cassettes to digital (Linear PCM) then I transferred these files to the computer.Due to cassette print-through, there is audible, albeit weak, pre-echo. This is not caused by the recorder since I can hear them playing the cassettes on a deck.So. Does Audacity have a pre-echo removal function, or can a similar result be obtained by applying different effects? Or any 3rd-party plug-ins?

View 1 Replies View Related

General :: Prevent ^C Echo When Ctrl-C Is Pressed?

Jan 10, 2011

I want to prevent "^C" from echoing when Ctrl-C is pressed. I did "stty -echoctl" which some googling results suggested. Now it echos raw Ctrl-C characters instead of the string "^C". That's not any better since it displays some funny blocked hexadecimal in the terminal window.

View 8 Replies View Related

Hardware :: Echo > /dev/lp0 Hangs When No Printer Is Connected?

Mar 17, 2010

I need to output a byte to LPT port. For this there's an option to program I/O ports directly (with ioperm & outb), but only if LPT port is a standard PC one (ports 0x378, 0x278, etc.). But i need a 'portable' way of doing this, i.e. which would also work on such interfaces as USB2LPT. I guess these adaptors will also have /dev/lp[0-9]* interface (am i right?). Here's what i get currently:$ echo 1 > /dev/lp0^CI.e. i have to use Ctrl+C because 'echo' never exits. When i had a printer connected to LPT, this did work

View 4 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 :: Doubt In Echo A For Beeping An Alert?

Feb 6, 2010

Below is the shell script that I am writing to beep an alert but listen to nothing.

Code:
#!/bin/bash
echo Listen to the alert!
echo -e "a"
echo listened ?

View 2 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved