I'm trying to get the end result to have the same format as this as well:
1 bin 2 daemon 67 erozner
[code]....
Where the numbers are the number of processes being run by the user (the name right next to it).if I input the command egrep myFile into the terminal, it should look for every line with the letter x in myFile, right?
I create a bash script that writes another bash file. But in the generated bash file I want to write a bash command in the file and not executing it.Here's my bash file:
Code: #!/bin/bash cat > ~/generateGridmix2data.sh << END
honestly, I'm not too experienced in this, and i've searched the net without luck. can anyone advise what i'm supposed to do to kill these imap processes every 5 min via cron job?
I am trying to create a function within my .bashrc that will process all of the files that do not end with .sh within a directory and execute them.The following is what I have so far. I am missing a way of excluding files that end with .sh though.
function startall { for file in /etc/init.d/*.; do "${file}" start
The application I am using writes a report file (ascii), but I am not able to print it, because from inside the application I have no access to the shell and so cannot invoke any printing command (lpr, lp, ...). Is there a tool/daemon which waits for a file in a given directory, takes it, and sends it to a printer?
the problem i have is that when i enter my username, the output (my real name) does not display in the output.txt. instead it displays in putty. so when i run my script in putty it shows the message to enter username and after i enter my username my real name appears below it. i want it to show in the output.txt
I use a network printer (HP Laserjet 1300n). Since a few days ago I couldn't print anything, the error message is 'Unable to write print data:Broken pipe'. What could be wrong? I replaced the cartridge recently, but nothing else.
I am trying to write a bash script that sources another bash script. Essentially, I need a few lines to check to see if a certain variable is set. If not, I set it manually, and then source a scripts with that variable in the path. I wrote a test script to try it, but for some reason the last line does not work. Here is what I wrote:
#!/bin/sh source ~setupdir/setup.shrc #just a test, this line works echo ${#SETUP} # prints 0 if setup is not set, which it isn't if [ ${#SETUP} -eq 0 ] then SETUP="~setupdir" fi echo $SETUP # prints ~setupdir
This pretend to be a script for rename a lot of files automatically. So I put the list of files in an array named @lista. But, as you can see, at the end of the command I use a sed filter to print out a backslash for those files that have spaces in their names, so the path for those files could be rightly interpreted.
But there's no way I could print a backslash. It works well when I use the Perl's sed substitution s///, but I need every path in the array to be fixed.
I'd like to add that the bash command works perfectly well alone. I mean outside the Perl script.
I have started using Ubuntu and I have to add a large number of users, over a thousand, using a Bash Script. I also have to give them a password. Do you create a text file first.
What options should I use when I'm using the sort command to sort the top 5 CPU processes (ps -eo user,pid,ppid,%cpu,%mem,fname | sort ??? | head -5) showing max to min usage?
I'm trying to avoid kill -9 for the reasons described in the Useless Use of Kill -9 form letter. Is this function sufficient, or do I need to kill the kill processes after a timeout or take care of other subtleties?
As an aside, what's a better name for this function? The current name reminds me of "Killing Me Softly", and manslaughter sounds a bit severe. Maybe spoon_kill (Google it)?
I have been looking for a script example of reading and writing to the parallel port's data, status, and control registers using bash. I see it done in pascal, tcl, etc. but nothing in bash.
I need to to write a bash script using an If...Then...Else statement that will accept a day of the week from the command line what do I do or where do I go.
I am trying to write a bash script to call from a terminal that will change the terminal title. I am using ubuntu 10.04. The script is meant to be used in the gnome-terminal.
Here is what I have:
Code: #! bin/bash echo "New title: c" read title echo "33]0;$titl07c" -e
[Code]....
it doesn't work
I think the problem has to do with modifying PS1 inside the bash so i tried this:
Code: echo `export PS1="[e]1;u@h:wa]${debian_chroot:+($debian_chroot)}u@h:w$ "` and it still didn't work.
I do not know how to write either PYTHON or Bash Shell Scripting. I am to learn one for Linux Administration purpose. Which one will you recommend for a Linux Admin/Eng environment?
I've been looking for how to set this up in bash with no luck so far. I can change what file the history log is written to, and how much history is saved. But it only writes the saved part when bash exits. Instead, I'd like to have bash write that file continuously as each command is entered (and maybe also do an fsync(2) to flush it to disk). That way I can see the command I crashed the box with Anyone know the magical incantation for that?
But there appears to be nothing that I can find there, in the man page, or other searches, that suggest it even can do continuous.
I mean codes on how to write a bash script for locate file. E.g: This utility shows you all files and directories that have a specific substring in the name. Press '?' for help, 'q' for quit or enter your search terms:
Kuala bin I have searched for two terms for you, Kuala, which has three hits: /usr/share/zoneinfo/Asia/Kuala_Lumpur /usr/share/zoneinfo/posix/Asia/Kuala_Lumpur /usr/share/zoneinfo/right/Asia/Kuala_Lumpur bin, which has 2312 hits. Are you sure you want to see all of those? [Y/n] n Press '?' for help, 'q' for quit or enter your search terms: Sorry, you didn't enter any search term. Press '?' for help, 'q' for quit or enter your search terms: q
<edit>never mind dump the ;'s and it all works fine</edit> I'm trying to write a bash script that will check if XMBC is running if it is then do nothing else start it then do some other things.This is the start
trying to learn how to write a bash script that will create a new text file named jimbola in my home directory. The file will need to be able to have the first and last name of Jim Bola included in it.
In my tmp directory some logs are creating continue (with name logs.txt1, logs.txt2 up to 245). Some times these logs are creating continue within 1 or 3 second gap, now I want to write a bash script that continue monitor the tmp directory and if any time logs create simultaneously within 1 or 3 section gap it will alert me..( generally logs are create with the gap of 5 or 10 minutes duration or some time after one hours )