Sponsored Content
Top Forums Programming code that reads commands from the standard i/p and executes the commands Post 302103741 by reborg on Sunday 21st of January 2007 08:32:26 AM
Old 01-21-2007
I don't think you have fully understood what your own code is doing, with respect to the context in which it is executing commands relative to the shell in which it is invoked.
 

10 More Discussions You Might Find Interesting

1. Linux

how to get source code of Unix commands?

Can anyone tell me how/where to get the source code for the unix commands like "ls ,finger,cp....etc" commands . I have tried very hard but failed so far. Thanks JAGDISH MACHHI (4 Replies)
Discussion started by: jagdish.machhi@
4 Replies

2. Shell Programming and Scripting

Can BASH execute commands on a remote server when the commands are embedded in shell

I want to log into a remote server transfer over a new config and then backup the existing config, replace with the new config. I am not sure if I can do this with BASH scripting. I have set up password less login by adding my public key to authorized_keys file, it works. I am a little... (1 Reply)
Discussion started by: bash_in_my_head
1 Replies

3. UNIX for Dummies Questions & Answers

taking a look at the code for some commands

just curious -- I was wondering if it's possible to open the file for a command and look at the code (say for the command more). I've just read about the PATH variable and the type command to find out where the file is, but when I tried to open the file, the terminal exited and logged me out. ... (3 Replies)
Discussion started by: Straitsfan
3 Replies

4. Shell Programming and Scripting

Executing Commands From Non-Standard Path (Changing user's PATH secretely???)

Hi: I have a requirement as below: I have some standard Unix commands modified and kept them in a directory say /usr/clsh/bin. For example I have a script named "ls" kept here which is modified version of "ls" (say it always gives long listing i.e. ls -l). When any user logs on and types... (2 Replies)
Discussion started by: ramesh_samane
2 Replies

5. UNIX for Advanced & Expert Users

Source code for Unix commands

hi Folks!! Just got a question in mind.... Is it possible for us to read the c code of the commands in the bin directory? I work on a LINUX server and i only see executables in the bin directory which i obviously can't read. Please help me regarding this. Thanks in advance and wishing you a very... (2 Replies)
Discussion started by: bdiwakarteja
2 Replies

6. Shell Programming and Scripting

how to run non-standard commands in bash script?

Hello All. I suspect that this will be a clear noob question, but I haven't been able to figure it out using the usual methods, so I turn to you. I've written a script to create input files for the quantum chemistry program NWCHEM. Generally you create an input file and then execute it by... (12 Replies)
Discussion started by: EinsteinMcfly
12 Replies

7. Shell Programming and Scripting

Code for running commands one after other

I need an if code in shell script where it should continue to further commands after succesfully installing the executable file. i.e. /run installer is continuing but in the middle it executes further commands like "cp /root/user which were given after /run installer. I want /runinstaller... (16 Replies)
Discussion started by: sriki32
16 Replies

8. AIX

HACMP: difference between 'cl' commands and 'cli' commands

Hi all, I'm new in this forum. I'm looking for the difference between the HACMP commands with the prefix "cl" and "cli". The first type are under /usr/es/sbin/cluster/sbin directory and the second are under /usr/es/sbin/cluster/cspoc directory. I know that the first are called HACMP for AIX... (0 Replies)
Discussion started by: peppix
0 Replies

9. Shell Programming and Scripting

Differences in printed commands after execution with same code

I have a korn shell script that executes a function which is stored in a common library. In the function there is obviously some code. Here is the line of code in the function in question: temp=`echo $status_cnt|tr -d ` When the shell script executes with set -x, I'm seeing that on most... (2 Replies)
Discussion started by: mjf
2 Replies

10. UNIX for Beginners Questions & Answers

Not able to execute standard commands on centos 7 server

I am not able to run basic commands on my centos 7 server. The PATH variable looks correct I think. I have not seen this before and not sure what to do next. Thank you :). # cd /usr/bin # ls bash: ls: command not found... Similar command is: 'lz' nano ~/.bashrc bash: nano: command not... (6 Replies)
Discussion started by: cmccabe
6 Replies
exit(1) 							   User Commands							   exit(1)

NAME
exit, return, goto - shell built-in functions to enable the execution of the shell to advance beyond its sequence of steps SYNOPSIS
sh exit [n] return [n] csh exit [( expr )] goto label ksh *exit [n] *return [n] ksh93 +exit [n] +return [n] DESCRIPTION
sh exit causes the calling shell or shell script to exit with the exit status specified by n. If n is omitted the exit status is that of the last command executed (an EOF also causes the shell to exit.) return causes a function to exit with the return value specified by n. If n is omitted, the return status is that of the last command exe- cuted. csh exit causes the calling shell or shell script to exit, either with the value of the status variable or with the value specified by the expression expr. The goto built-in uses a specified label as a search string amongst commands. The shell rewinds its input as much as possible and searches for a line of the form label: possibly preceded by space or tab characters. Execution continues after the indicated line. It is an error to jump to a label that occurs between a while or for built-in command and its corresponding end. ksh exit causes the calling shell or shell script to exit with the exit status specified by n. The value is the least significant 8 bits of the specified status. If n is omitted then the exit status is that of the last command executed. When exit occurs when executing a trap, the last command refers to the command that executed before the trap was invoked. An end-of-file also causes the shell to exit except for a shell which has the ignoreeof option (See set below) turned on. return causes a shell function or '.' script to return to the invoking script with the return status specified by n. The value is the least significant 8 bits of the specified status. If n is omitted then the return status is that of the last command executed. If return is invoked while not in a function or a '.' script, then it is the same as an exit. On this man page, ksh(1) commands that are preceded by one or two * (asterisks) are treated specially in the following ways: 1. Variable assignment lists preceding the command remain in effect when the command completes. 2. I/O redirections are processed after variable assignments. 3. Errors cause a script that contains them to abort. 4. Words, following a command preceded by ** that are in the format of a variable assignment, are expanded with the same rules as a variable assignment. This means that tilde substitution is performed after the = sign and word splitting and file name genera- tion are not performed. ksh93 exit is shell special built-in that causes the shell that invokes it to exit. Before exiting the shell, if the EXIT trap is set, it is invoked. If n is specified, it is used to set the exit status. return is a shell special built-in that causes the function or dot script that invokes it to exit. If return is invoked outside of a func- tion or dot script it is equivalent to exit. If return is invoked inside a function defined with the function reserved word syntax, then any EXIT trap set within the function is invoked in the context of the caller before the function returns. If n is specified, it is used to set the exit status. On this manual page, ksh93 commands that are preceded by one or two + symbols are special built-in commands and are treated specially in the following ways: 1. Variable assignment lists preceding the command remain in effect when the command completes. 2. I/O redirections are processed after variable assignments. 3. Errors cause a script that contains them to abort. 4. They are not valid function names. 5. Words following a command preceded by ++ that are in the format of a variable assignment are expanded with the same rules as a variable assignment. This means that tilde substitution is performed after the = sign and field splitting and file name genera- tion are not performed. EXIT STATUS
ksh93 If n is specified for exit, the exit status is the least significant eight bits of the value of n. Otherwise, the exit status is the exit status of preceding command. When invoked inside a trap, the preceding command means the command that invoked the trap. If n is specified for return, the exit status is the least significant eight bits of the value of n. Otherwise, the exit status is the exit status of preceding command. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWcsu | +-----------------------------+-----------------------------+ SEE ALSO
break(1), csh(1), ksh(1), ksh93(1), sh(1), attributes(5) SunOS 5.11 2 Nov 2007 exit(1)
All times are GMT -4. The time now is 08:29 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy