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
ADVERTISEMENT
Dec 16, 2010
What is the difference between
$echo cat
$cat echo
View 1 Replies
View Related
Nov 29, 2010
I am not really a Linux or unix user, so apologies if the question seems too easy to be asked on the forum, but I tried using the search engines and failed.
Code:
cat < foo 2> bar
Why doesn't this get redirected to stderror on error conditions?
View 9 Replies
View Related
Jun 4, 2011
If I do the following, if the URL is a redirect, it doesn't work
rpm -ivh http://path/to/rpm
I have to use wget http://path/to/rpm which resolves the redirect and downloads the file, then run rpm on that file.
More for my knowledge of bash than anything else, would there be a way to redirect the file downloaded from wget into the rpm (something like redirection or pipes or something), so that they could be combined into one command and you wouldn't explicitly save the file first.
Something like... rpm -ivh << wget http://path/to/rpm
I have one more question, and that is whether there is a command in linux, such as wget, that would let me pass it a URL and output the redirected-to URL if the argument.
e.g. ('wget --someflag http://orig/url' would output 'http://url-after-redirects-followed')
View 2 Replies
View Related
Jun 23, 2011
I was unable to find an answer to something that (I think) should be simple:
If you go here: [URL]
like so:
wget [URL]
you'll probably end up with a file called "download_script.php?src_id=9750"
But I want it to be called "molokai.vim", which is what would happen if I used a browser to download this file.
Question: what options do I need to specify for wget for the desired effect?
I'd also be ok with a curl command.
View 2 Replies
View Related
Apr 28, 2011
I have the following bash script:
#do some time consuming task here read -p "Give me some input: " input
Now as you might've guessed, if users press some random keys during the "time consuming task," they're read into input as well. how do I clear stdin (or at least ignore it) before I issue the read command?
View 1 Replies
View Related
Jul 28, 2010
I am trying to write input to a shell and get the shell to parse the input that I am writing to it as if a user was typing in commands.
Thus far I have tried echoing some text into the shell's FD for STDIN in /proc/<pid>/fd Whilst this displays the text that I echo, the shell that I am writing to never tries to execute the command that I pass to STDIN. What is the difference between a shell taking STDIN from the user and data written to STDIN by another process e.g. echo ? It appears I am missing something fundamental.
View 5 Replies
View Related
Jun 28, 2010
Is it possible to redirect stdout and stderr from one terminal say /dev/pts/2 to another /dev/pts/3?
I tried the following:
Code:
/dev/pts/2 2>&1 /dev/pts/3&
Then when I run a command the process stops.
View 4 Replies
View Related
Oct 19, 2010
how to echo an '-n' without a new line?
View 8 Replies
View Related
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
Nov 28, 2010
What does echo $$ give as output?
View 3 Replies
View Related
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
Jan 23, 2011
This happens at random and the problem persists even when using an alternative browser (Firefox & Chrome), being redirected to the same website. Sometimes it's [URL] going to [URL] going to AOL Lifestream.
View 4 Replies
View Related
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
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
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
Aug 12, 2010
Is it possible to echo the arrow keys (up, down, left, right) in bash?
View 4 Replies
View Related
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
Feb 27, 2011
Would like to know how to turn "echo" off in a shell scripting. I wrote a shell script, testing a condition, after the condition tested. On the other line I used the echo Command to echo a line, then on the other line I used the "read" command to read an input typed. The crux here is the string or line inputed is what I would like to turn off. Distro is redhat linux.
View 6 Replies
View Related
Apr 11, 2011
How to print "hello" infinite times without using implicit or explicit loop.
View 1 Replies
View Related
Sep 16, 2010
We're going to be doing a rather large server deployment, and using the provisioning system we have in place there is no current way to just "copy" a file over to the servers. All files/scripts have to be run from the provisioning server.Due to network constraints, the provisioning system can't run a script we need to run (requires certain network assets to complete, but as soon as we modify the network settingshe provisioning system loses access to the server and can't run the script). So,our network configuration script to create the other script on the server in /root when it runs.My original method was to do something along the lines of:
Code:
#network configuration statements here
....
[code]...
View 2 Replies
View Related
Jan 8, 2010
I want to suppress the output resulting from the commands in my scripts, when writing batch commands in dos I would just use @Echo Off.
I have written an example of what I want to achieve
Code:
#!/bin/bash
clear
@Echo off
[Code]....
View 8 Replies
View Related
Mar 18, 2010
Please explain why
Code:
echo some_directory | xargs cd
is not working.
Code:
echo some_directory | xargs ls
is working as expected.
View 14 Replies
View Related
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/scriptnm.sh; if I run it as . /scripts/scriptnm.sh I am getting the desired output.
View 4 Replies
View Related
Dec 23, 2009
How can i enable caps lock by using echo command. I know that by using syntax echo -e "33[3q" this only turns the capslock led to glow. but the capslock is not working i.e. the words are typed in small case only.
Then by using xmodmap command i.e. syntax xmodmap -e "remove lock = Caps_Lock" or xmodmap -e "add lock =Caps_Lock" doesn't work. On running this it shows unable to display.
View 1 Replies
View Related
Jan 2, 2010
can anyone tell me how can one enable capslock by using echo command. ofcourse we can glow the led by using the echo command.
Its syntax is echo -e "33[3q"
On searching i found that by using $xmodmap -e "add lock=Caps_Lock" we can enable capslock. but its not working.
View 1 Replies
View Related
Dec 1, 2009
Can any body tell me where can i found the source code for echo command. so that i can download it such that it can help me for further studies on echo command
View 8 Replies
View Related
Mar 1, 2011
I logged into my Red Hat Enterprise Linux machine at work (use it for software development) and the primary GUI does not load. Instead, widgets appeared for xclock, xterm, and Firefox. In the terminal, I start typing in commands to try to figure out what's going on, but all commands are not found except pwd and echo. I 'echo $PATH' and that returns just an empty, blank line. 'echo $SHELL' lets me know I'm using cash.
The likely cause was my attempt to install Adobe Reader Firefox plugin yesterday. After it downloaded, I ran the binary but Firefox didn't seem to recognize that I had installed it, so I went into my .cshrc file and added the adobe folder to the path. That didn't seem to work, so I gave up, deleted the binary and the folder I installed to, and removed that directory from the path in the .cshrc file. This last thing (the export PATH line in that file) I'm certain is back exactly as it was before.
I have successfully added the /bin and /usr/bin back to the path from command line via
setenv PATH /usr/bin:/bin
but of course it doesn't stick after reboot nor does it magically load the primary GUI. I'd rather not go through the effort of creating a ticket for our company's Global Service Desk cuz there's no telling how long that could take to resolve. In the meantime, I can't do any programming.
View 23 Replies
View Related
Mar 17, 2010
I faced a issue with updating a file contents with echo command which fails with error as below:
echo "foo" > bar //to create a file named "bar"
echo "foobar" > bar //to edit its contents
The latter fails, it prompts "File exists" i.e.
~>echo "foo" > bar
~>echo "foobar" > bar
bar: File exists.
~>cat bar
foo
~>
View 4 Replies
View Related
Feb 25, 2011
I have to run "pppd call idea" command from root shell every time to connect to internet from mobile. Now I want a script so that I just run it to connect. Something like :
#!/bin/sh
echo "password" --stdin | su -
pppd call idea
But its showing error that "standard in must be a tty". Why is this. Using CentOS 5.5
View 2 Replies
View Related