Red Hat / Fedora :: Change Input/Output Color In Bash?
Jun 5, 2009When in the interactive envirment, my Input and Output are all mess-up. So i want to color the Input and Output with two different colors.. so i can figure them out..
View 1 RepliesWhen in the interactive envirment, my Input and Output are all mess-up. So i want to color the Input and Output with two different colors.. so i can figure them out..
View 1 RepliesI am writing a bash script that utilizes the output of another script (which I will refer to as script#2.) Script#2 is not owned by me, I cannot modify it. All of the output from script#2 is blue, which makes it difficult for me to read.
I would like to have the output of it changed to grey. Is there a way I can do that in my script? A command I can pipe the output to?
Edit: One other question related to this. I put a trap function in my script that works well. Script#2 essentially runs a tail -f. When I ctrl+c to stop it, it stops script#2 and never calls the trap in my script. Is there any way I can work around that?
I really don't know what to call it, but I want to change the color of text that appears before you type in whatever your input is.
For example:
Code:
negrabee@david-desktop:~$ ls /home/david/
I would want "negrabee@david-desktop:~$" to be in a different color. When you have whole bunch of commands and text in a full screen terminal, it gets really annoying to have to look for where you're entering the command so changing the color.
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.
Code:
#!/bin/bash
curl -s -u USER:PASS -d status="$@" http://twitter.com/statuses/update.xml > /dev/null
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 am looking for a prgramme that output the lyrics when I give it an mp3...
Code:
fetchlyrics mymp3.mp3
based on its data inside of mp3
I am not sure if that Subject really explains it, basically I have a script that executes a CLI java-applet that requires a passphrase from the user. I can easily execute this by issuing the -p argument followed by the passphrase however that shows up on possible logs or at least on the results of the ' ps ' command. If you do not supply this -p argument it provides a new line with the echo " Enter Passphrase: " and asks for input.
how can I provide a result/input for the Passphrase request and is it still possible to throw this application in the background with the ' & ' following the command? I have seen a few examples that show a /bin/expect that expects a result and sends a command however I would like to refrain from any extra dependencies. Example of Regular Execution of application:
Code:
$ /usr/local/***/**** -u USERNAME -r Default-Realm -f certificate.der
Password:
I am having a strange problem I've never encountered before. I have an Asus Eee S101 10.1" netbook with the 32GB SSD. I installed Ubuntu 10.04 Netbook Edition.
The other day, I was browsing with Firefox, when suddenly the entire computer came screeching to a halt. Had to power it down with the power button. After this happened, I have been unable to use the same Firefox profile I had been using. I had to start Firefox from the command line with the -ProfileManager switch, then create a new profile to keep browsing.
I wanted to completely get rid of the old profile, so from the Profile Manager I tried to delete the old one. Computer hung, had to reboot with the power switch. I then tried to browse to the .mozilla/firefox directory and delete the profile's directory there, from both Nautilus and the command line. Both times, the computer froze.
I tried a few more times, and the couple of times the computer didn't freeze, I got an error from the command line saying a Bash input/output error. After this error appeared, it would appear no matter what command I ran - I couldn't even run a sudo reboot now.
I can create/delete other files and directories, just not that Firefox profile.
I am getting more and more comfortable working with the shell, thus I would like to change its prompt color to my liking, as it will be easier for me to distinguish commands vs. outputs.
I've read a couple of instructions of how to change the .bashrc file and am familiar with what the codes in PS1 mean. Except, this file can be intimidating to newbie eyes.
Where exactly on the file is it that I need to make the change?
Here is what I am trying to do. I would like my prompt to like exactly like the prompt I use in Backtrack - which consist in two different colors, one for the host and another for the pwd. Here is what the Backtrack .bashrc file looks like:
# /etc/profile: This file contains system-wide defaults used by
# all Bourne (and related) shells.
# Set the values for some environment variables:
export MINICOM="-c on"
export MANPATH=/usr/local/man:/usr/man:/usr/X11R6/man:/usr/local/share/man:/usr/bin/man:/usr/share/man
export HOSTNAME="`cat /etc/HOSTNAME`"
[Code]....
I also read that in order to have the same results when I log in as root, I will have to copy the modified .bashrc file into /root
I am using sda1 as /, which is a bootable drive. I do not know if my problem is that I did not create a /boot drive. After removing the iso dvd, I tried to reboot and I get this back: -bash: /sbin/reboot: input/output error Then it returns me to the terminal prompt.
View 6 Replies View RelatedI got a good one!I colorized my prompt as follow; Green for normal user, Red for root:
Root .bashrc:
PS1=e[0;31m[ ][u@h:w][!]\$ e[m"
User .bashrc:
PS1="e[0;37m[ ][u@h:w][!]\$ e[m"
Which gives:
[Code]...
My dad is out of town for a while, so I've been using his computer to rip my DVDs with Handbrake. He has Windows Vista installed, so I did a full installation of Fedora 13 on a thumb drive and just run everything off of that. However, when I went to delete some of the encoded videos after I had moved them to my computer, I got a system error that said 'can't delete files: I/O error.' Now, if I try to boot up Windows, his computer is stuck on a black screen checking a bunch of dlls. He'll be back in a couple of weeks, so I'd like to have it fixed by then.
View 2 Replies View RelatedI'm trying to clone 2 raid sets using dd.( have done this successfully many times in the past)
this time however running into issues.
dd stops with a 'input/output error'
dmesg shows:
A little above this i find
Background: this is a proliant sevrer & has got XFS filesystem on it. Last weeek it showed some XFS errors, tried to do a repair but didnt work.So thought would clone the raid set from a good 'source' server. ( we need this for a test purpose )
Before cloning I deleted raid & created again. everything looked OK, all disks showed as GOOD, but then the dd copy failed with above msg. I'm sure the source raid set is in good condition. Any thoughts on what could be wrong here & how I may be able to recover it?
I even threw some video DVDs at it to make sure it wasn't the disc.
Code:
[pickens@acer1 Videos]$ dd if=/dev/sr0 of=POTC.iso
dd: reading `/dev/sr0': Input/output error
5088+0 records in
[code]....
I am getting the same thing on my laptop running Mandriva, oddly enough. Two different drives, two different computers, two different distros and multiple DVDs.
When running rsnapshot tonight it failed with a bunch of
cannot remove `file': Input/output error
errors.
I navigated to the directory and tried to delete it manually and I got the same errors. I tried with 'sudo rm directory'. How else can I delete this directory? What would cause a situation like this?
I'm either missing the obvious or have four identically defective tape drives. Each is a Seagate or IBM Travan drive (yes, I know they're old and I need to access the data; they were in Win boxes) using QIC-80/DC-2120 media. I've been trying to solve this using three Fedora boxes (different versions) and one Debian machine.
The OS's recognize the drives and they show up as /dev/st0.
With no media in the drives, I get a status report; with media inserted, I get the same input/output errors.
Examples (all as root):
With tape inserted:
With no tape in drive:
With tape inserted
Everything I've found on Google suggests that the drives are defective.
I booted my Fedora 13 live CD on my Dell server, and configured networking and SSHd. On my desktop I logged into the live cd and started copying over a big file (1.5 GB) (i.e. copying from the desktop computer to the server). After copying about half the fil, the download fails with an error message about the filesystem being read-only.I've seen this exact same behavior on both i386 and x86_64 of the same live CD, but don't know why it's happening. I've also had the same issue when copying small files. In /var/log/messages these messages are repeated many times:
Code:
Dec 20 12:32:23 localhost kernel: Buffer I/O error on device dm-0, logical block 684075
Dec 20 12:32:23 localhost kernel: lost page write due to I/O error on dm-0
[code]....
What commands do you use to set the INPUT, OUTPUT, and FORWARD chains in iptables to ACCEPT?
View 5 Replies View RelatedI'm trying to install Wine on Fedora 13, I tried installing it from the "Add/Remove Software Repository" but the installation fails, I tried installing it from the Terminal using the following command as root: "yum install wine"
Here's the output I get:
Code:
i can input chinese in vim ,gvim,gedit ,and also zsh...., but i can't input chinese in bash and sh , i use ibus.
If i login with another account , i can input chinese in bash and sh !
i also diff the locale and env between the two account ,they are nearly the same;
example: when i input chinese ""i type "wq" and space,then bash print :
Display all 4063 possibilities? (y or n)
I have a strange issue with my RAID5 array - it worked fine for a month, a couple days ago it didn't start on boot with mdadm reporting "Input/Output error" - I didn't panic restarted my computer, same error. Then opened a Disk utility and it reported State: Not running, partially assembled - don't know why, I've pressed Stop RAID Array and started it again, voila - it reported State: Running - I've checked components list and there was nothing wrong with it. So I run Check Array utility, waited almost 3 hours to finish it and it worked since than, till today's morning - I've started my computer, and here we go, same error.
See screenshots:
This is an initial state just after computer startup:
This is after I stop and start RAID5:
This is a components list:
I can see nothing wrong there yet not sure why mdadm fails on boot. I do not really like the windows solution I guess, when I check my array again, it will work fine again, but it then can fail in the same way without known reason.
stopped using fedora and I can't remember the name of softwares which allow to change the mouse cursor, and others which allows to change the colors of the windows
View 2 Replies View RelatedI recently got a real fancy unidirectional microphone, but when I go and use it, something strange happens. The mic is a mono mic, but when I record something, it appears to think it's stereo. Instead of having the same thing on both channels, it puts it all in the left channel, and silence on the right channel.
I tried fiddling with alsamixer. In capture (F4), adjusting the "Capture" device has an effect. However, it doesn't do anything useful. Lowering the right channel to zero does nothing, lowering the left channel to zero creates silence, and disabling the right channel creates silence.
In my System>Preferences>Sound (or pavucontrol, or what-have-you), there are "Analog Stereo Input" and "Analog Stereo Duplex" options there, but no "Analog Mono Input" or "Analog Stereo Output + Analog Mono Input" options (the latter being ideal).
Something interesting, though, if I do this:
Code:
arecord -r 96000 -D pulse -c 1 -vv -V mono /dev/null
it works correctly and outputs on both channels. But if I do
Code:
arecord -r 96000 -D pulse -c 2 -vv -V stereo /dev/null
then it's back to the same behavior. The VU meter on the second command shows the left channel going up and down as I make noise, but the right one always at zero.
The machine does have a crap internal mic built in to the screen bezel. If I do either of the above commands, they both work correctly. The stereo VU shows the same activity for both channels.
The machine is a Eee 1015PED, which has Intel integrated sound. Something probably insignificant is that the mic has a 1/4 inch mono plug, and to get it to plug into the Eee, I needed to get a 1/4 female to 1/8 male adapter. The mic's 1/4 plug is mono (duh) and therefore two-conductor, but the adapter I got is stereo, or three conductor (L, R, GND). I don't know if this is tripping something in hardware to tell it it's stereo or something.
I tried the mic on my desktop, which has a SB Audigy 4 (the non-pro flavor) and that has the "Analog Mono Input" function, so that works fine. Is there some way to turn this stereo input into mono input?
how do I change the font color of the fast user switcher applet?
View 1 Replies View RelatedI installed Lucid. I used to have Ubuntu 9.10 and to connect my iPod to my laptop's speakers. There was an option in 9.10 in the Sound Options to change the Mic Input into a Line Input. But now unfortunately I can't find it in Lucid have only 2 audio ports in the laptop: Headphone port, Mic port.
View 9 Replies View RelatedI changed it and got it working a long time ago but i installed 10.10 (great work BTW ) and have forgotten completely.
View 6 Replies View RelatedIs 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.
View 2 Replies View RelatedIs there any way to colorize the output of aptitude as in 'pacman-color'? I would like to use ~/.Xdefaults colors.
View 1 Replies View RelatedWhen I type (in new 10.10) soem cmdline comands like "ls -l" then some of the directories have a different fore-and background color (e.g. black on green) while the remaining other directoreis are blue on white.
Where can I find out the meaning of the diferent colors and how can I change them?
If I go to menu
Terminal->Edit->Profile Preferences->Color
then I can set only the full overall background and foreground color. But here only certain parts have a different color. the main color (black on white) is suitable. I do not use system theme.
I was attempting to change the bash shell color prompt on my RHEL / CentOS 5 server. When I login as my user account on my server I can see my 'PS1':
Code:
[carlos@srv1 ~]$ echo $PS1
[u@h W]$
I want to change my PS1 to:
PS1='[e[1;32m][u@h W]$[e[0m] '
When I look in ~/.bashrc, I don't see my 'PS1' line so I am confused and wondering how I do this on RHEL / CentOS systems.
I am working on a script that allows me to convert an IP address to a country name. I have 2 files. One that has text like: PORT.80 TCP SRC=x.x.x.x and the other is x.x.x.x United States. How can I combine these files so that the file output is PORT.80 TCP SRC=x.x.x.x United States?
View 5 Replies View Related