10 More Discussions You Might Find Interesting
1. UNIX for Beginners Questions & Answers
How to find a word in a directory which contains many files?
i just want to count how many such words are present in all the files?
This is the code which i tried for a single file
echo "Enter the file name:"
read file
echo "Enter the word to search:"
read word
if
then
echo "The count... (4 Replies)
Discussion started by: Meeran Rizvi
4 Replies
2. Red Hat
hi dudes, i m a new user of RHEL-6. how will i start programming of c / c++ in this environment ? where will i type my code & how will i execute ? are any extra packages needs to be installed ? if yes, from where will i get those packages?
waiting for reply from someone...... (2 Replies)
Discussion started by: Amitcpp50
2 Replies
3. Shell Programming and Scripting
Hi
i have a small script like this
$ cat test.sh
#!/usr/bin/sh
name="ram"
echo ${1}
set 1 2 3 4 5 6 7 8 9 0 123 o870
echo $9
echo ${12}
when i am trying to execute like below i am not getting the output
jena samp_perl $ sh test.sh
test.sh: This: not found (12 Replies)
Discussion started by: ragilla
12 Replies
4. UNIX for Dummies Questions & Answers
Hi
i have a file in which there are three fields
code:
919804199233 404911130003916 357266044991350F
and now i want to add two more fields i.e.
code:
919804199233 404911130003916 357266044991350F ms 123
how can i do it using command line
and if have a file of 100... (8 Replies)
Discussion started by: esumiba
8 Replies
5. UNIX for Dummies Questions & Answers
Hi
i am using expect module and trying to login using following code.
ssh 127.0.0.1
expect "word:"
send "$password \n"
kindly let me know the login script using expect module (1 Reply)
Discussion started by: esumiba
1 Replies
6. Shell Programming and Scripting
hi,
Pls bare with me if this is trivial.
Is it possible to run a korn shell with out specifying the name with its extensiion?
Do i need to make any changes to the script make it work?
Thanks (3 Replies)
Discussion started by: dvah
3 Replies
7. Shell Programming and Scripting
Hi All,
I want to echo a message in case a system is reachable by ping or echo a different message in case it's not reachable.
Sample code i wrote is
ping localhost -n 2 | grep 'ttl' > ping_op; ls ping_op > /dev/null && drReachable=Alive; echo -e `date`: \\t "DR server is reachable" >>... (5 Replies)
Discussion started by: Mr. Zer0
5 Replies
8. Shell Programming and Scripting
I have an expect script that interrogates several hundred unix servers for both access and directories therein using "ssh user@host ls -l /path". The combination of host/path are unique but the host may be interrogated multiple times if there are multiple paths to test.
The expect script is run... (2 Replies)
Discussion started by: twk
2 Replies
9. UNIX for Dummies Questions & Answers
I want to execute a shell script without ./ symbol.
For example:
./my_script ===== my_script (both of them can execute my script)
both of them are the same as result. (2 Replies)
Discussion started by: mehmetned
2 Replies
10. UNIX for Dummies Questions & Answers
Hello,
Can somebody tell me the differnce between a call of a ksh with the dot :
>. script.ksh
and the call without the dot:
>script.ksh
In my script I have writen a test for the number of parameters:
if
then echo 'Usage : '$0
exit 1
fi
as my script doesn't need any... (3 Replies)
Discussion started by: Cecile
3 Replies
command(1) User Commands command(1)
NAME
command - execute a simple command
SYNOPSIS
command [-p] command_name [argument...]
command [-v | -V] command_name
DESCRIPTION
The command utility causes the shell to treat the arguments as a simple command, suppressing the shell function lookup.
If the command_name is the same as the name of one of the special built-in utilities, the special properties will not occur. In every other
respect, if command_name is not the name of a function, the effect of command (with no options) will be the same as omitting command.
The command utility also provides information concerning how a command name will be interpreted by the shell. See -v and -V.
OPTIONS
The following options are supported:
-p Performs the command search using a default value for PATH that is guaranteed to find all of the standard utilities.
-v Writes a string to standard output that indicates the path or command that will be used by the shell, in the current shell execu-
tion environment to invoke command_name, but does not invoke command_name.
o Utilities, regular built-in utilities, command_names including a slash character, and any implementation-provided functions
that are found using the PATH variable will be written as absolute path names.
o Shell functions, special built-in utilities, regular built-in utilities not associated with a PATH search, and shell reserved
words will be written as just their names.
o An alias will be written as a command line that represents its alias definition.
o Otherwise, no output will be written and the exit status will reflect that the name was not found.
-V Writes a string to standard output that indicates how the name given in the command_name operand will be interpreted by the shell,
in the current shell execution environment, but does not invoke command_name. Although the format of this string is unspecified,
it will indicate in which of the following categories command_name falls and include the information stated:
o Utilities, regular built-in utilities, and any implementation-provided functions that are found using the PATH variable will
be identified as such and include the absolute path name in the string.
o Other shell functions will be identified as functions.
o Aliases will be identified as aliases and their definitions will be included in the string.
o Special built-in utilities will be identified as special built-in utilities.
o Regular built-in utilities not associated with a PATH search will be identified as regular built-in utilities.
o Shell reserved words will be identified as reserved words.
OPERANDS
The following operands are supported:
argument One of the strings treated as an argument to command_name.
command_name The name of a utility or a special built-in utility.
EXAMPLES
Example 1: Making a version of cd that always prints out the new working directory exactly once
cd() {
command cd "$@" >/dev/null
pwd
}
Example 2: Starting off a ``secure shell script'' in which the script avoids being spoofed by its parent
IFS='
'
# The preceding value should be <space><tab><newline>.
# Set IFS to its default value.
unalias -a
# Unset all possible aliases.
# Note that unalias is escaped to prevent an alias
# being used for unalias.
unset -f command
# Ensure command is not a user function.
PATH="$(command -p getconf _CS_PATH):$PATH"
# Put on a reliable PATH prefix.
# ...
At this point, given correct permissions on the directories called by PATH, the script has the ability to ensure that any utility it calls
is the intended one. It is being very cautious because it assumes that implementation extensions may be present that would allow user func-
tions to exist when it is invoked. This capability is not specified by this document, but it is not prohibited as an extension. For exam-
ple, the ENV variable precedes the invocation of the script with a user startup script. Such a script could define functions to spoof the
application.
ENVIRONMENT VARIABLES
See environ(5) for descriptions of the following environment variables that affect the execution of command: LANG, LC_ALL, LC_CTYPE,
LC_MESSAGES, and NLSPATH.
PATH Determine the search path used during the command search, except as described under the -p option.
EXIT STATUS
When the -v or -V options are specified, the following exit values are returned:
0 Successful completion.
>0 The command_name could not be found or an error occurred.
Otherwise, the following exit values are returned:
126 The utility specified by command_name was found but could not be invoked.
127 An error occurred in the command utility or the utility specified by command_name could not be found.
Otherwise, the exit status of command will be that of the simple command specified by the arguments to command.
ATTRIBUTES
See attributes(5) for descriptions of the following attributes:
+-----------------------------+-----------------------------+
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
+-----------------------------+-----------------------------+
|Availability |SUNWcsu |
+-----------------------------+-----------------------------+
|Interface Stability |Standard |
+-----------------------------+-----------------------------+
SEE ALSO
sh(1), type(1), attributes(5), environ(5), standards(5)
SunOS 5.10 17 Jul 2002 command(1)