Sponsored Content
Top Forums Programming Calling a shell script from a C program Post 302436100 by gaurav1086 on Friday 9th of July 2010 07:33:38 AM
Old 07-09-2010
hello

You need system() function to call scripts or other commands. you can use "wc" command to count the number of records returned by it.

Regards,
Gaurav.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Calling SHELL script from C program

Hi, I just tried to call a simple script from a pretty simple C program. I could not succeed :-( a message was thrown saying "sh: line 1: "Script name with path": Permission denied" The C program and shell script are below, both are in the same directory and shell script is given... (7 Replies)
Discussion started by: Chanakya.m
7 Replies

2. Shell Programming and Scripting

Calling Functions of Other K Shell Program

Hi, I have a K shell a.ksh function abc { // Some logic } In b.ksh i have included the a.ksh ./a.ksh I want to call the abc function from this b.ksh script. Thanks Vijay (2 Replies)
Discussion started by: vijaykrc
2 Replies

3. Shell Programming and Scripting

calling a program (w/ params) from within shell

Hi all, I need to call some script (s1) from within my shell script (s2). s1 accepts parameters and I want to feed it with values of params from my script. I tried many things but none work (I am so much of a beginner), please help one of my attempts : . . . param1="hehe" param2="haha" ... (12 Replies)
Discussion started by: Lorna
12 Replies

4. Shell Programming and Scripting

calling 'n' number of shell scripts based on dependency in one shell script.

Hello gurus, I have three korn shell script 3.1, 3.2, 3.3. I would like to call three shell script in one shell script. i m looking for something like this call 3.1; If 3.1 = "complete" then call 3.2; if 3.2 = ''COMPlete" then call 3.3; else exit The... (1 Reply)
Discussion started by: shashi369
1 Replies

5. Shell Programming and Scripting

Run shell script from C program by calling fork and execl

I need to write a c program that uses the fork and excel system calls to run the shell script mode invoked like this: "./mode 644 ls -l" (that is the argumetns will always be 644 ls -l) here's the mode script: #!/bin/sh octal="$1" shift find . -maxdepth 1 -perm $octal -exec $@ {} \; ... (3 Replies)
Discussion started by: computethis
3 Replies

6. UNIX for Dummies Questions & Answers

Calling a c program using perl script

On bash I run precompiled c Program as follows: ./create_cust 1 10000 US S > us_cust.csv create_cust is a c program and requires 4 parameters. I am redirecting the output of this program to csv file I need to run this same program in perl I am aware of exec command though not... (7 Replies)
Discussion started by: gkbond
7 Replies

7. Shell Programming and Scripting

Calling a shell script from a C program

Hi, I have a shell script which connects to a database and fetches the count of the records from a table. I want to embed this whole script in a C program. Also the count fetched should be available in the C program for further usage. Please let me know how this can be done. Thanks ... (0 Replies)
Discussion started by: swasid
0 Replies

8. Shell Programming and Scripting

Calling perl script in shell program

How to call a perl script in shell program / shell scripting. PLS HELP ME (2 Replies)
Discussion started by: hravisankar
2 Replies

9. Homework & Coursework Questions

Calling compiled C program with Perl program

Long story short: I'm working inside of a Unix SSH under a bash shell. I have to code a C program that generates a random number. Then I have to call the compiled C program with a Perl program to run the C program 20 times and put all the generated random #s into a text file, then print that text... (1 Reply)
Discussion started by: jdkirby
1 Replies

10. Shell Programming and Scripting

How to pass the environment name while calling java program from unix script?

Hi, I'm trying to test one unix shell script in dev environment. But I'm not sure how to pass the environment in my java program calling code. I'm trying to use -DconsumerEnv="DEV" but unfortunately I get 'null' while trying to print the value from java class. System.out.println("Environment: "+... (4 Replies)
Discussion started by: Pramit
4 Replies
mt(1)							      General Commands Manual							     mt(1)

Name
       mt - magnetic tape manipulating program

Syntax
       mt [-f tapename] command [count]

Description
       The command permits the operation of a magnetic tape drive.

Options
       The  -f	flag  option  uses  the specified tape device (next argument) in place of either that tape device defined by your TAPE environment
       variable (.login or .profile) or /dev/nrmt0h.

       Some operations may be performed multiple times by specifying count.  By default, performs the requested operation once.

       The command argument defines the operation to be performed.  Only as many characters as are required to uniquely identify a command need be
       specified.

       The following is a list of commands:

       bsf		   Backspace count files.

       bsr		   Backspace count records.

       cache		   Allows to use the cache buffer on a tape drive that has the cache buffer feature.

       clhrdsf		   Clear  hardware/software problem.  Works with tape drives which use the TMSCP tape controller interface This command is
			   restricted to root access only.

       clserex		   Clear serious exception.  Works with tape drives which use the TMSCP tape controller interface

       clsub		   Clear subsystem.  Works with tape drives which use the TMSCP tape controller interface This command	is  restricted	to
			   root access only.

       eof, weof	   Write count end-of-file marks at the current position on the tape.

       eotdis		   Disable  end-of-tape  detection.   When the end of tape is reached, the tape will run off the reel.	Only the superuser
			   can issue this command.  The command remains in effect for the device until end-of-tape detection is enabled  with  the
			   eoten command.

       eoten		   Enable  end-of-tape	detection.   When the end-of-tape markers are reached, the tape is halted on the reel, between the
			   two end-of-tape markers.  Only the superuser can issue this command.  The command remains  in  effect  for  the  device
			   until end-of-tape detection is disabled with the eotdis command.  This is the default mode after a system boot.

       fsf		   Forward-space count files.

       fsr		   Forward-space count records.

       nocache		   Disables the use of the cache buffer for any tape drive that has the cache buffer feature.

       offline, rewoffl    Rewind the tape and place the tape unit off-line.

       retension	   Retensions the tape.  Retension means moving the tape one complete pass between EOT and BOT.

       rewind		   Rewind the tape.

       status		   Print status information about the tape unit.

Examples
       This example shows how to rewind the tape
       mt -f /dev/rmt0l rewind
       This example shows how to backspace the tape nmt1h three files:
       mt -f /dev/nrmt1h bsf 3
       This example shows how to write two end-of-file marks at the current position on tape nmt6h:
       mt -f /dev/nrmt6h eof 2

Return Values
       In  shell  scripts, returns a 0 exit status when the operation(s) were successful, 1 if the command was unrecognized, and 2 if an operation
       failed.

Files
       /dev/rmt?h or /dev/rmt?l
		 Raw magnetic tape interface with rewind when closed

       /dev/nmt?h or /dev/nmt?l
		 Raw magnetic tape interface with no rewind when closed

See Also
       dd(1), tar(1), ioctl(2), mtio(4), tms(4), environ(7)

																	     mt(1)
All times are GMT -4. The time now is 08:33 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy