Programming :: Shell Script For Multiple OS?

Jun 28, 2009

i need a script that will give as much system info such as CPU usage, partition info, mem usage, etc.. from multiple OS's, FreeBSD, AIX, HP-UX. I only know SCO unix and dont know the commands on the other OS's.

View 2 Replies


ADVERTISEMENT

Programming :: Write A Shell Script For Submitting Multiple Jobs Sequentially

May 27, 2010

I want to write a shell script for submitting multiple jobs sequentially. For example,

#!/bin/bash
qsub job1.sh

# when job1.sh is done, run the next one

qsub job2.sh

how to make the shell script know that job1.sh is done and now I can run job2.sh?

View 4 Replies View Related

Programming :: Shell Scripting / Create A Shell Script Similar To Ls?

Jun 5, 2011

I am trying to create a shell script similar to ls, but which only lists directories. I have the first half working (no argument version), but trying to make it accept an argument, I am failing. My logic is sound I think, but I'm missing something on the syntax.

Code:
if [ $# -eq 0 ] ; then
d=`pwd`
for i in * ; do
if test -d $d/$i ; then
echo "$i:"
code....

View 10 Replies View Related

Programming :: Bash-shell-like Less Functionality In The Python Shell?

Jun 25, 2010

Is there some type of functional way to read things in the Python shell interpreter similar to less or more in the bash (and other) command line shells?

Example:

Code:

>>> import subprocess
>>> help(subprocess)
...
[pages of stuff to read]
...

I'm hoping so as I hate scrolling and love how less works with simple keystrokes for page-up/page-down/searching etc.

View 4 Replies View Related

Ubuntu :: Not Allow Multiple Logins To The Shell?

May 20, 2010

Is there a way to prevent a user from being able to login more than once. Not a one-time login, but a single login. What I'm trying to do here is in moving our email system, an email user would login to this account, enter some password information, sync up their email, and have the passwords files removed, then log off. Next user can log in to the same account.

The reason for the single login is to protect the user's passwords.

View 1 Replies View Related

Programming :: Prevent "leak" Into Shell From A Customized Shell Menu Script?

Dec 15, 2009

I've created a simple script based menu. This menu will be accessed by only a certain users via ssh.When user logs in, the menu will automatically run. (configured at user's .bash_profile).How do I force the session to close when user hits Ctrl-C or Ctrl-Break ?In a nutshell, I don't want user to have access to shell.

View 11 Replies View Related

Ubuntu :: Comparing Multiple Files In Shell Script?

Jun 13, 2010

I've got an interesting challenge for the shell scripting wizards here. I've got a mySQL dump of three files for my amarok database with the intention of copying some files to my media server (cover art) so that I can keep the server the server and not rely on my local machine.

Step 1: Identify any cover art files on my local machine.

I did this with:

Code:
mysql -u amarok -p amarok -e "SELECT * FROM images WHERE path like '%.kde%'" > cover_art.txt
Output looks like this:

[Code]....

What I have here now is the ENTIRE album list in my collection -- and something to compare the IDs in Step 1 against. I'm going to stop here and will update the thread as I get past this stumbling block. "ID" in cover_art.txt = "image" in albums.txt... straightforward enough, right?

So the question is this: how do I create a simple shell script that will loop through the IDs in cover_art.txt (i.e. characters 0 -> 4 -- it will always be a 4 digit ID) and then search for that ID in the Albums.txt file.

View 3 Replies View Related

General :: Count Multiple Objects In Shell Script?

Jul 21, 2010

Trying to count the number of oracle instances on HPUX 11.23 - using ksh. I have multiple instances running and I would like to have a count for how many processes for eachinstance.Example, run the 'ps -efu oracle' command and for each instance increment a counter. So I am looking forINT1=# INT2=# INT3=# ... INTn=#I keep thinking a 'do-while' or some type of 'while' loop but I am missing something, somewhere

View 2 Replies View Related

General :: Passing Multiple Arguments In Shell Script?

Dec 11, 2010

The script receives multiple files as parameters and it is supposed to count the number of lines in each of them and write that number in another file.

This is my script:

Code:

while [ -n "$1" ]
do
lines=`cat $1 | wc -l`
echo "The number of lines in file $1 is $lines." >> lines.txt
shift
done

Is there any other way to do the same thing, without using shift?

View 7 Replies View Related

General :: Debugger For Shell Script - Get Rid Of Multiple Exit Command ?

Jun 14, 2010

My two doubts:

(i) In office i open many terminal windows when i start my day and in each terminal i keep on login as different users many times in a day to do some task, by the end of the day when i need to exit from all terminals in a safeway instead of directly closing it i need to execute exit command or CTRL+D many times to close a single terminal safely. Can anybody tell me a way to exit from each terminal in single go, is there any command to acheive this ? I wish if we had a command like exitall like in vi we have :qa command to close multiple files opened in single window. I hope friends you have got what i am asking for ?

(ii) I want a software for debugging shellscripts searched a lot but dint got it.

View 7 Replies View Related

General :: Shell Scripting: Getting Multiple Input Files For An Application?

Sep 21, 2010

I am running an application called QuantiSNP [URL]. The binary file is "quantisnp2", called upon in the "run_quantisnp2.sh" supplied by the authors. I am only able to run the application for single file processing (e.g. 1 input file for 1 sample; I can't run the batch file processing because I don't have the necessary BeadStudio report files, which has different formatting for the input files).

The difficulty is that I have 300 samples (300 unique sample IDs) and 3 input files for each sample for a total of 900 runs of this application. I am wondering how would I be able to automate this process as a shell script instead of basically manually changing the sample ID and respective input files every time a run completes? I bolded the single file processing shell script command line options below that need to be changed for each sample/input single file processing run. The command line option "--sampleid" is for the name given to the processed output files corresponding to the sample of interest and there are 3 input files for each sample.

/home2/jason/QuantiSNP/quantisnp/linux64/run_quantisnp2.sh /home2/jason/QuantiSNP/MCR/v79/ --config /home2/jason/QuantiSNP/quantisnp/config/params.dat --levels /home2/jason/QuantiSNP/quantisnp/config/levels-affy.dat --outdir /home2/jason/QuantiSNP/quantisnp_out/ --sampleid sample1 --gender female --input-files /home2/jason/files/sample1_input.txt

Note that each sample has 3 input files, for a total of 3 runs of "quantisnp2" for each sample. e.g.

SAMPLEID INFILE
sample1 /home2/jason/files/sample1_input.txt
sample1 /home2/jason/files/sample1_input2.txt
sample1 /home2/jason/files/sample1_input3.txt

[code]....

View 7 Replies View Related

Server :: Shell Script To Create Multiple LVM's Or Raw Devices For Syabse

Mar 22, 2011

I have Disk /dev/cciss/c0d1: 599.9 GB, unallocated on CentOS release 5.4 .

I need to create about 30-40 LVM's worth 500GB as raw devices for sybase . is there a way to script it or anyone already has it ?

The problem is that each time we need to do fdisk /dev/cciss/c0d1 and enter the partition no to create a new one .. how to overcome that problem and automate it in a script ?

View 3 Replies View Related

General :: Shell Script File - Pass Multiple Parameters To Interpreter?

Feb 2, 2011

I have a Python script that I run which needs to execute under a special environment, so I would run the program like so from my working directory (~/project/src):

python manage.py shell

This opens up an interactive shell for me to start typing my own commands.I have another set of administrative activities that I would like to house in another directory (~/project/admin). The manage.py is really finicky about running from the working directory. So, to make this whole thing work, I made a script which starts off like so:

#!/usr/bin/python ../src/manage.py shell

There are a couple problems with this. The first is that it doesn't work:

/usr/bin/python: can't open file '"/../src/manage.py" shell': [Errno 2] No such file or directory

How do you specify multiple parameters to the interpreter?How do I change the working directory?

View 2 Replies View Related

Programming :: Shell Programming - Delete User Input

Jan 21, 2011

I recently started shell programming and my task now is to do a menu display.Currently i am stuck whereby user will input both title and author and it will delete it.

Do i have to use sed command?

View 4 Replies View Related

Programming :: Possible To Assist In Programming Shell Scripts?

May 17, 2010

Is it possible to assist in the programming Shell Scripts
Job:
To send a message to the email,All orders written in Terminal or ssh
example : ls , pwd , cat , and other

View 1 Replies View Related

Programming :: Programming To Multiple Video Cards

Jun 24, 2009

I've browsed the internet, but haven't found a satisfying answer. Hope this forum can help me in the right direction.I'm exploring the possibilities of creating a program that manipulates (writes to) two different video cards.I program in C and hope to avoid high level libraries like Xlib to keep the mem footprint as low and the performance as high as possible. Windowing is not important no desktop environment will be used. Be able to write two pixels (one to each screen) to would do.

How would I go about?To give an idea of the solution I'm looking for:One screen will show thumbnails of images on the hard drive. Clicking an thumbnail on display A will show the selection full screen on display B. On a laptop; preferably thumbnails on the laptop screen and the selected image on the external monitor.Is this possible with just low-level libs or do I need X or some third-party software to make life easy?

View 14 Replies View Related

Programming :: How To Turn Non-interactive Shell Into Interactive Shell?

Feb 4, 2011

I have a situation where I am in a non-interactive shell. I have tried from within my non-interative shell to spawn an interactive shell but my output still does not goto me. Isn't there a way I can somehow go into /proc or somwhere and make the output my /dev/tty1? Or some way else to remedy this?The situation arises because I drop from my restricted shell environment (a sort of CLI interface), into the actual Linux shell. I cannot change the code of the CLI environment I am just faced with being in the linux shell environment and its non-interactive. Its very annoying to have to put > /dev/tty1 after every command I type.

Not to mention it seems damn near impossible to get pagers like more and less to work properly when your in a non-interactive shell.

View 2 Replies View Related

General :: Runs Multiple Shell Script Inside A Main Script Using Crontab?

Oct 22, 2009

I wrote a simple shell script called main.sh and inside it calling another shell script called rename.sh.Both are placed in a same directory.[/home/srimal/test]

$cat main.sh
Code:
#!/bin/sh

[code]...

View 4 Replies View Related

Programming :: Shell Script To Tee ITSELF

Dec 10, 2008

I have a shell script that I would like to log to stdout and also to a file.....much like using tee. I would like to, instead of calling the script and piping to tee...i would like for the script to tee itself.

View 4 Replies View Related

Programming :: How To Create Own C Shell

Jul 11, 2010

i got to build my own linux shell for my project

View 5 Replies View Related

Programming :: Can Awk Take A Shell Variable

Jul 23, 2010

I have been searching most of today and am stuck on getting a variable into an awk portion of my bash script. I have this working:

Code:

#!/bin/sh
SRC=/var/log/mail.log
DEST=/var/www/output/myFile.txt
VAR=userName@myDomain.tld

[code]....

Can awk take a shell variable? Or do I have to do something completely different?

View 11 Replies View Related

Programming :: How To Use Scp In A Shell Script

Apr 2, 2011

I need to push out a file to a bunch of linux and solaris boxes so I was hoping to use a script to automate the process with scp (or something else / better) - how can I batchmode scp so that it will do this? I should mention the servers do have keys set up so I do not have to authenticate manually or through something like an expect script...

View 4 Replies View Related

Programming :: Reg Sed On Shell Script?

Feb 16, 2010

I am having a shell script with following lines

ORIG_LOG_ARCHIVE_FORMAT=`grep log_archive_format $LOG_DIR/init$CLONE_DB.ora | cut -d"=" -f2`
SRC_LOG_ARCHIVE_FORMAT=`sqlplus -s "/ as sysdba" @$SCRIPTS_DIR/log_archive_format.sql`
echo $ORIG_LOG_ARCHIVE_FORMAT

[code]...

When I execute this script I am getting below output

'enin16_%t_%s_%r.arc'
enip131_%t_%s_%r.arc
sed: command garbled: s/'enin16_%t_%s_%r.arc'/

However when I do the exact above command on unix prompt (refer below) after setting values for all variables, it is not giving sed garbled error message. May I know what should I do to make it work inside the script as well?

$ cat init_refresh$CLONE_DB.ora | sed "s/$ORIG_LOG_ARCHIVE_FORMAT/$SRC_LOG_ARCHIVE_FORMAT/g" > $LOG_DIR/init_refresh1$CLONE_DB.ora
$

View 3 Replies View Related

Programming :: How To Write A Toy Shell

Mar 24, 2011

I'm trying to write a toy linux shell. For starters this is what I'm trying to do:

1. Start a new process with fork.

2. Execute a program in the new process with execl().

3. Redirect the output from the new process from STDOUT to another file descriptor, using dup2(2).

4. In the parent process, read the output from the child process and write it to the screen.

Creating a new process and executing a program in it is no problems, the problem is that I can't seem to capture the output from it in the parent process.

Code:

//digenv
//C++arl 2011-03-24
#include <stdio.h>
#include <sys/types.h>

[code]...

View 14 Replies View Related

Debian Programming :: How To Use Shell Command

Sep 6, 2013

How to use shell command?

installs.sh:

Code: Select allapt-get install icedove-l10n-hu
apt-get install rar
apt-get install ...
...
y press key or other language is other key. hungarian key is: i

english after apt-get install in gnome-terminal: (y)es or (n)o
hungarian after apt-get install in gnome-terminal: (i)gen or (n)em

How to yes or no automatically in all languages? Not manual, not 'Y'/'I' or 'N'/'N' keydown.

I would like use this script my fresh installed Debian 7.1. I would like run this install.sh when Debian is installed for my all softwares when i would like use.

10 PC installing easy and faster my script.

If no script is slowly install for my 10 PC.

View 2 Replies View Related

Programming :: Detection Of A Command In Shell?

Apr 2, 2010

I would like to know if there is any way to detect a command if it going to be executed in the shell?

Eg:
Cmd: sudo apt-get clean I want a C program to be called before this cmd is executed.

View 8 Replies View Related

Programming :: Arrange The Results In The Shell?

May 10, 2010

Im having problems with this little thing in a C example Im doing. I want to show in the shell like this example:

Name Birthday
Tomas 13
Adrian 24
Nate 15

Im trying to use the printf function but the names doesnt have the same lenght. So I cant do it like this:

printf("Name Bithday
");
printf("%s %d
");

View 4 Replies View Related

Programming :: Setting Variables In C-shell?

Jul 12, 2010

I'm running into a problem when I try to set a variable to an awk output in c-shell. Right now my command is Code: set STR_MSG_TYPE = `awk -F{ '/msg_type/ {print $2}' <filename> | tr -d }'/''*' ` I then run echo to see what the output is and it returns blank, however, when I run the same awk command from the command line, I get an actual output of "MT-715". Am I setting my variable incorrectly? I do something similar using the date command to set a STR_DATE variable earlier in the code and it works fine and I use the same syntax.

View 1 Replies View Related

Programming :: GDB Terminates When Spawned From Shell

Nov 22, 2010

I want to spawn a GDB session from bash script and keep it working to interact it from outside. But when I start it in background (with '&' sigil).

Code: gdb -x gdb_script.txt ./a.out < gdb_pipe.fifo &
It executes passed script and terminates by itself (I do not pass any data or signals to it)

Code: Breakpoint 33, main (argc=1, argv=0xbffff0f4) at main.c:53
---Type <return> to continue, or q <return> to quit---53
read_main_config();
(gdb) quit

A debugging session is active.
Inferior 1 [process 5957] will be killed.
Quit anyway? (y or n) [answered Y; input not from terminal] What can I do to make it alive?

View 1 Replies View Related

Programming :: Exporting In A Shell Script?

Nov 26, 2010

I am aware this has probably been covered hundreds of times, so apologies if so. I am fairly new to the linux scripting scene, so again apologies if what I'm saying seems pretty odd and makes no sense. I am attempting to write a script for some Linux Fedora test servers I have set up. For me to change which domain I have this set to point to, I would have previously changed the HOSTS and profile files manually, however I managed to make a script which changes these easily with the use of one command to launch the script.The problem I'm having is getting it to use the "export" command. I am aware this would have to be launched in the parent shell rather than the child and so I made a seperate script which has "export SIP_DOMAIN="test.blah.net" in it and had the first script "source" it. This doesn't work and I've probably done something somewhere that is incredibly stupid.

View 2 Replies View Related







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