Programming :: Allow Interleave Output When Run Commands Concurrently?

Feb 23, 2011

I am working on the shell using c language. I just would like to ask when I run some command in the backgrounds, how can I allow interleave out? I want to the output like this:

shell> command1
shell> command2 &
shell> command3

[code]...

View 3 Replies


ADVERTISEMENT

Programming :: Write Output Of Two Commands To A File?

Oct 12, 2010

I'm writing output of top command to a file However since top does not provide time I would like to append the 'date' command and then write all this to a file.

so something like top -d 1 -b; echo 'date' >>file

View 1 Replies View Related

Programming :: Python : Pass Output Of System Commands To Variable?

Jan 25, 2011

I'm trying to write a python script that will use the current user's name when interacting. Ex: when started, it should say "hello daweefolk" when I am logged in.
I've tried
Code:
username=os.system("echo $USER")
but the variable remains empty.
What is the correct code?

View 1 Replies View Related

Programming :: Making Sure Only One Instance Of Script Runs Concurrently

Dec 11, 2010

I need to write a shell script that will be run from cron every minute or so. The script will use rsync to keep some folders across several machines in sync. I am very new to shell scripting so some answers might seem obvious but they are not to me:

1. How do I check at the beginning of the script if the script is already running and abort if it is? I saw that most processes use a PID file for that but I am not sure this is the right case for that and in fact how to do it exactly

2. Assuming the list of target machines/dirs to sync are supposed to come from some config file. How should I code that? Just use the normal shell tools that I already know (cut etc) or is there a better way?

View 6 Replies View Related

Programming :: C: Testing Multiple Consecutive Array Values Concurrently.?

Nov 22, 2010

Basically, I am provided with a file "temp.dat" with 30 high temperatures (integers) in it. The program is supposed to read them in and compute/print the average. Then it is supposed to print the temperature of each day and, in addition, display a + by each day that is over the average, but only if it is above the average high for three or more consecutive days. This is the part I am stuck on. I'd appreciate any tips that would point me in the right directionFull disclosure: This is a school project. Code:

Code:
#include <stdio.h>
#include <stdlib.h>

[code]....

View 2 Replies View Related

Fedora :: Interleave Windows From Several Applications In GNOME3?

May 28, 2011

I have yet another minor source of confusion in GNOME3... Imagine this: you have opened several terminal windows which cover most of your desktop, and a Firefox browser window. In Firefox you have an image which contains some data that you must type to one of the terminal windows. Since the data is in an image (not as a text), you can't use cut & paste to transfer it from Firefox to terminal.

In GNOME2 (and Windows), you can interleave the Firefox window and the terminal window so that the terminal window is on top of the Firefox window. You can place the terminal window so that it does not cover that part of the Firefox window which contains the data that you must type to the terminal window.

But in GNOME3, if I activate the terminal window, all open terminal windows are shown on top the Firefox window. In order to see the Firefox window again, I have to minimize or move those terminal windows which cover the part which I want to see while typing into the one terminal window. I think this is clumsy. Is there any way to switch back to the GNOME2 behavior which allows interleaving windows from different applications?

View 3 Replies View Related

General :: Different Output Of FTP Commands

Jul 31, 2009

I am getting different output of FTP commands in linux and unix. We are migrating an application from unix to linux.

The following output i am getting in unix and linux.

In UNIX 64 the dir command will give the details along with pathname at end ( BOLD )

But in RHEL 5 i am just getting the file name.

Is thery any way to get the pathname in dir command of FTP in RHEL 5.

View 2 Replies View Related

General :: Replace A Character With The Output Of Some Commands Using Sed?

Mar 16, 2010

rm -f /www/emailout/template.html
TODAY=`date '+%d-%m-%y'`
DBRUN=`ps ax | grep dtd `
sed -e 's/ncTODAY/'"$TODAY"'/g' -e "s/ncdbrun/'"$DBRUN"'/g" /www/emailout/test1.html > /www/emailout/template.html

But, I can't get the output of $DBRUN ?

View 14 Replies View Related

Debian :: Lxterminal Not Showing Full Output From Commands.

Aug 4, 2010

I'm currently running Testing/Sid on my machine with Fluxbox as my window manager.Yesterday I noticed that I was not getting full output from commands using lxterminal.First off I tried another terminal,which was the xfce4-terminal.The result being exactly the same,missing output.I have also tried re-generating my xorg.conf,and yes you guessed it no change.Getting desperate I also tried dpkg-reconfigure console-setup,still missing output from lxterminal.So to sum up why do I get the full output with xterm but not lxterminal which I have been using previously for some time.

View 5 Replies View Related

General :: Which Commands To Use To Output The Current Users Logged Into The System

Apr 27, 2010

Which commands do you use to output the current users logged into the system and accessing a specific file?

View 5 Replies View Related

Ubuntu Servers :: Useful Server Information - Php File - Runs A Few Commands And Echoes The Output

Jan 25, 2010

Php file that basically runs a few commands and echoes the output. It's for checking things like temperatures etc, space free.

You can see it in action here: [url]

I've attached the actual php file.

Two questions:

1) What more can I add to it to give me even more information?

2) I want to add hddtemp but it requires sudo to run. How can I get around this?

View 4 Replies View Related

Server :: Mount A Drive Or Partition On Multiple Servers Concurrently?

Jan 19, 2011

I am tasked with setting up 3 out of the 6 servers and dividing up 500GB of space in the most efficient manner amongst the 3 servers. The space is in a pool which can be assigned to virtual drives. Each virtual drive can be assigned as disk0 or disk1 and so on to one or more servers. They'll be running CentOS.

On the second try I came up with this scheme:
shared sda1 -- /boot (ext3)
shared sda2 -- /home (ext3)

[code]....

View 5 Replies View Related

General :: Good Desktop/application Or Command Line Tool To Show Two Different Timezone Concurrently?

Jul 18, 2011

I want to find a desktop application or command line tool to show two different timezone concurrently under LINUX.

Anyone knows there are such application?

Say i want to know the time at london and USA at the same time. (different time zone)

View 4 Replies View Related

Programming :: How To AutoFill Commands

May 17, 2010

How can i get full command as and when a partially finish typing in Linux Command prompt. or is there a way i can get the command from history of commands executed automatically when i type instead of opening history and looking for the command?

View 7 Replies View Related

Programming :: Cc And Gcc Commands Don't Work

Nov 14, 2010

I've tried instralling the c and c++ compilers on my fedora 13 machine and none of them seem to work. For example. i have this extremely simple c program that i try to compile and nothing works.

Code:
#include "stdio.h"
printf("Hello World");

[Code]....

View 6 Replies View Related

Programming :: Use Varibles Within Sed Commands ?

Nov 1, 2010

I've written a for loop with a counter i and I want to use the value of i within sed to edit certain lines of text within a fortran file.I want the the x=10 will be replaced by x =1(counter from the loop).. and so on.But from the following code my x = 10 is replacing by x = i.So

I am getting error.

View 3 Replies View Related

Programming :: Run System Commands In Php?

Jun 4, 2010

With the command "tail -300 /var/log/apache2/access.log | less" i can look in the log for the 300 latest visitors from my logfile. and i wanted to ask if it's possiblle to get that command to run from a php file and if yes how ?? how i run system commands in php? i use debian if it matters.

View 1 Replies View Related

Programming :: Way To Add Some Sort Of I-/usr/include Commands

Feb 27, 2011

I'm learning GTK , and would like to use Codeblocks, and/or KDEvelop, and compile my c files using that, but always get an error about gtk/gtk.h not found, but can't figure out how to add the commands... I normally type gcc -o Program1 main.c `pkg-config --libs --cflags gtk+-2.0` That's a lot to type every time to compile.. Isn't there an easier way, in KDevelop, Monodevelop, and/or Codeblocks to make this step quicker, by adding some sort of I-/usr/include commands, or something?? thanks in advance, =). I looked online for some results, but didn't come across anything handy..

View 1 Replies View Related

Programming :: Bash And Sed Or Awk Commands To Set Tabs?

Apr 25, 2010

want to set more text files. They have "tab" differently (3, 4, 6 or 5 characters space).I have to use "sed" or "awk" sette them in the same tab (for example five space haracters).

View 14 Replies View Related

Programming :: Execute Commands After Run Command?

Jan 13, 2011

I am executing a run command in a script after that i need to copy files into a directory which are the inputs for the run,on run a new shell is created and the remaining commands in the script does not execute,wot should i do to execute the remaining commands in the script??

View 2 Replies View Related

Programming :: Root Commands In SSH Script

Mar 1, 2011

I am trying to administer a small group of ubuntu desktops in my classroom. I can use ssh to perform administrative tasks one at a time on each machine, but I want to automate these tasks through a small number of scripts. I am having trouble with running root commands through a script.

On other distros, I think I would simply ssh into the root account, and run the script. But as an ubuntu user, I have only ever used sudo, and folks at ubuntuforums are understandably hesitant to recommend logging in as root. Instead I am seeing suggestions to disable the password requirement for each specific command I want to run, which does not seem like best practice.

Should I enable the root account, give it a password, and ssh to the root account to run the scripts? To be specific, the scripts will do things like install updates, install programs, add or delete users, configure the desktop, etc.

View 5 Replies View Related

Programming :: Execute SQLite Db Commands From C++?

Jun 10, 2010

Anyone know how to execute SQLite db commands from C++?

View 1 Replies View Related

Programming :: What Are The 'must Know' Concepts/commands In Valgrind

Jul 11, 2011

For example, in GDB we talk about breakpoints, watchpoints and core dumps etc. Similarly what are the 'must knows' in Valgrind?

P.S. I don't need any links to Valgrind manuals, I already have them.

View 2 Replies View Related

Programming :: Difference Between Two Find Commands?

Dec 27, 2009

Code:

find . -name *.txt

Code:

find . -name *.txt

View 10 Replies View Related

Programming :: Where Are BASH Commands Stored

Feb 21, 2011

Where are the other BASH commands/exe stored? If the commands are part of the exe of BASH than ls would not be in a path, correct?

View 11 Replies View Related

Programming :: Which Is Faster In These Fread() Commands

May 5, 2010

Which is faster:

fread(&buf, 1, 1024, fp);
or
fread(&buf, 1024, 1, fp);

[code]...

View 14 Replies View Related

Programming :: Run Interactive Commands From A Shell Script?

Aug 24, 2010

i need to run a command from a shell script that requires me to answer "Yes" to 2 questions that the command asks before it kicks off. how do i do this? i thought it was something like this.. from inside the parent script:

sh test.sh << "EOF
Yes
Yes

[code]...

View 3 Replies View Related

Programming :: Awk Commands Inside Of A Bash Script ?

May 4, 2011

im pretty sure this is a remedial task for many of you but im having an issue with arrays from a shell script being accessed in an awk command. im pretty good with shell scripting but i am embarrassingly unfamiliar with awk. so here's the meat of the script...


Code:

I am trying to take an input file of ip addresses and corresponding netmasks and put it into a format to be loaded onto a juniper switch. the result should look something like this.. x.x.x.x/netmask using the cidr notation. no matter what subnet is provided though, /32 always gets appended to the end of the ip even when it should be /16, /24, etc... also, the cisco part works fine so that doesnt need any attention.

View 5 Replies View Related

Programming :: Running Commands In Control Structures?

Apr 25, 2011

how to run a linux commands in shell programming using control structures.

View 1 Replies View Related

Programming :: Add Commands To A Limited Shell Program?

Apr 3, 2011

In below program I want to add (as part of the valid_cmds string) the pwd (print working directory), lo (logout), and cd (change directory) commands. However when I add those into original program ;
char *valid_cmds = " ls ps df pwd lo cd";
they are not working I have the cout message huh?
Original source code is below code...

View 3 Replies View Related







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