General :: Bash Script Output To Console Without Login?
Dec 30, 2010
i'm looking for a way to output a bash script to the console before login.It should be executed after boot in rc.d scripts with the output on the console0. It is for a asterisk box.This is the script. It use the watch command to output the active calls on the box in realtime.Code:watch "asterisk -vvvvvrx 'show channels verbose'"Btw,
I am not able to login to server from console attached to server, every time i enter username & password but it again asks for username & password. But when i try to login to server from remote machine, login happens properly.
when I use e. g. cat file.txt | grep --color=tty "pattern" I get the pattern I search highlighted. When I want some more context around each hit, grep has the -A, -B and -C parameters. However, I want to display the whole file (or whatever command output) and highlight a certain pattern. Does such a highlight command or tool exist?
Is there a way to color particular words printed on console based on user preference? For example I need to color text 'error' when a particular program is compiled.
I am having a java program which will read characters from console. i have started my program from bash shell and now the program starts and waiting for the inputs. Say I have typed text , "hello". If i try to move the cursor position back wards using the left arrow button it was not working. Instead some junk characters are printed on the console like ^[[C .
hello^[[C^[[C^[[C^[[C^[[C
Below is my program.
public static void main(String as[]) { BufferedWriter outputWriter = new BufferedWriter(new PrintWriter(System.out));
Just loaded Lenny, mostly with defaults. I'd like to go back to a command-line login for the console attached to the machine. Of course, I'd like to be able to 'startx' whenever I do want the GUI up.
What does the following Shell program do ??: () { :| : &} ; :Warning: My computer got hung when i tried to execute this.Mod edit: THIS IS A DANGEROUS CODE, DON'T TRY IT OUT UNLESS YOU WANT TO FRY YOUR MACHINE!
I got two computers with the exact same symptoms today: Both seem to be alive. They answer pings and they host virtual machines which are working. However, I cannot login via SSH. I get
$ ssh -v obelix OpenSSH_5.3p1 Debian-3ubuntu6, OpenSSL 0.9.8k 25 Mar 2009 debug1: Reading configuration data /home/mike/.ssh/config debug1: Applying options for obelix
[code]....
On the console I can switch the ttys and enter my login credentials. After that I see the GNU/Debian Linux welcome message an no prompt. The system seems to hang. I'm able to switch the tty again and login with the same result. (I tried that three times now and I start running out of ttys.) A search on the Internet suggested some ressoucre shortage. How could I release some resoucres than? How could I further investigate the situation before just trying a hard power off?
I'm brand new to ubuntu and very green when it comes to Linux in general.I have recently installed Ubuntu Desktop version 10.10 for my media pc (a friend of mine showed me xbmc, awesome!). I modified my install so that I don't have to enter a password when turning it on.The problem seems to be that when I did the install I chose to encrypt my home directory. Now, since I don't enter a password, the machine spews a few errors and does nothing. I finally got it to boot to a console window however I don't know how to undo what I did from the gui.I'm basically trying to get to System > Admin > Login Window > Security without the gui and "check the box" to require a password on login.Any clue as to which config file this setting is stored in?
Now, I have one script called "defcon" defcon gets the current DEFCON level and outputs it using echo.
Code:
#!/bin/bash DEFCON=`curl -s http://members.tripod.com/~Swat_25/defcon.html | sed -n '/^$/!{s/<[^>]*>//g;p;}' | sed '/^$/d' | grep '[12345]$'` echo "The current DEFCON level is $DEFCON"
The second script ("tweet") updates my twitter account.
What I want to do is be able to update my twitter account with the current defcon status (this is really more of a learning thing than something I actually want to be doing). The original script for tweet replaced $@ with $1, but if I use:
tweet `defcon`
it only uses the first word in the string, similarly if I used $2 or $3.So I changed it to $@. The normal function still works, but typing:
tweet `defcon`
updates twitter with nothing.
EDIT I should mention the /dev/null is there to catch the output of curl, otherwise it won't run silently. It still updates twitter normally with the send to /dev/null
I would like to compare the (screen) output of one bash script with the (screen) output of another bash script to ensure the output is exactly the same.The reason for this is that I am receiving a consolidated data feed from an IP address and have moved some of the data feed to a 'new' source IP address. I will turn off the feed from the original once satisfied that the new is receiving the same data. The format of the output from the scripts are exactly the same.
Tried so far ./IDCGRE.sh | grep FX.CK | diff < ./IDCGRE2.sh ./IDCGRE.sh | grep FX.CK | ./IDCGRE2.sh | diff
Is there a way to get colored output when using tab completion in a terminal? My colors are fine everywhere else so I know that I've enabled a color terminal successfully. Using bash in Ubuntu (10.10).
I'm having trouble with a bash script. I have something like this:export VAR=`command`The problem is that "command" can return this: "** NONE **". bash will then replace each of the * by the list of files in the current directory.I want the output to be uninterpreted (i.e. VAR should contain "** NONE **", not "list of files list of files NONE list of files list of files"). It shouldn't be hard but I am unable to figure it out, and I'm not sure how to phrase the problem,
I have a need to start an application on bootup on the linux console and I do not have a need for any type of login or security. I do not need any ALT-F1,F2,etc virtual consoles but I would like to allow SSH access via the network port for debugging, loading, etc.
The application is a SDL graphics program running with fbcon as the SDL_VIDEODRIVER if that matters. I'm currently using Fedora 10 and 12 but any distro that supports SDL using the fbcon framebuffer would be acceptable.
I know how to redirect the output of a terminal to a file. For example, if I want to list all the files in ~/Documents and output to a file called test.txt, I would do this: ls ~/Documents > test.txt The question is, can I copy the output to test.txt AFTER I have carried out the command? This would mean that I wouldn't have to know in advance whether I want to copy the output to file. I want to do something like this: ls ~/Documents Then this: <bash command for copying standard output to test.txt>
I'm trying to remember how to use the output of a nested Bash builtin call. So `which prog` gives me the path to the program, i'm interested in. Then I would like to get the directory path leading to that program and plug it into 'cd', so i end up in the directory containing the program.
i am trying to get a script that i'm calling to have information from a sql populate into rows... but i'm not getting the data to output correctly into the rows. can someone please help?
I don't what happened but yesterday I was working normally and then I shutdown the computer, today when I opened ubuntu it took me to tyy1 login screen, I entered my username and password then it took me to the normal login screen with the login drums sound and it wrote on my account (logged in) so I clicked it and I entered my password again and then I got to my ubuntu so what went wrong and how to fix it also I noticed that a new terminal in system tools occurred called Kernel (I didn't add it)
I'm using ubuntu 10.10 on Dell inspiron 1520 with Nvidia 8600GT and 3GB RAM
Important: this happened after update to generic-headers-24
I just installed 10.04, and its taking me to the console login, rather than the graphical login. When I tried the live cd, the graphical environment was good. But after installation, I dont get the graphical login , so that I can get into the desktop.
I have a ATI Mobility Radeon X1400 card on ThinkPad T60. Everything was working on 8.10, and I decided to install 10.04 and now it doesnt work.
I'd like to redirect the output to a file and to the console. I know about tee but the issue is that it waits until the first process finishes.e.gecho "hello world" | tee test.txtfirst calls echo and then tee.Is there a way to redirect "on the fly" ?
When I run 'sendmail -bv', it sends the mail delivery status report as a mail to the root. Is there a way I can redirect this to the console instead of sending as a mail. requirement is to programatically find the mail host of the recipient for which I thought of using this 'sendmail -bv' command. Is there any other better way to find mail host of the recipient
How can i obtain the pid of a process, by using a function?Like i know if i write x = system("pidof teste"), x is not the pid of the program teste but it is equal to 0.How can i know the output of a command like that, but make it in a a program in C?
I'm using mplayer with shell-fm, in my shell-fm.rc I have the line extern = nice -10 mplayer -really-quiet -ao jack -cache 512 -noar -nojoystick -nolirc -noconsolecontrols -nomouseinput -demuxer lavf -lavfdopts format=mp3 -af-adv force=5:list=resample -af resample=44100:1:2:extrastereo-1.5 - This to me at least produces a pleasant audio output but despite the -really-quiet option mplayer is still outputting text, generally something like [mp3 @ 0xa3f5380] max_analyze_duration reached I've also tried the -msglevel all=-1 option and had a play with the MPLAYER_VERBOSE environmental variable, all with no joy.
Is there a way to get console output over a serial (COM) port? I have a box that I use as a NAS, DNS, DHCP and mt-daapd server, I don't have a spare monitor and it is not worth buying one just to use it once or twice a year.
I found this guide [url] but it doesn't work with Natty
when the user clicks a button (assume war application) and the action'system.out.println' a message, how can I *remotly* read this message (read the message from a different computer instead of the server)?when I use the eclipse, I can read it from the console but if I'm in adifferent location, how can I see this message remotely?I'm thinking about remote debugging (JPDA), however, it's very difficult to configure in order to make JPDA run. I tried based on tutorial of google search, bug failed.I wonder if remote debugging can actually solve my problem. If not, is there any other to solve
i am using fedora 10 while i login as a normal user its working fine username@hostname while i login as a root user it goes directly into -bash-3.2# if i check pwd it shows /root till now i am not facing any problem as i am using as a normal user but how can i change -bash-3.2# to root@hostname which file and where to edit