In the olden days before the arrival of modern shells, we would use the case statement to test strings. The case statement is the only built-in function in the original Bourne shell that supports regular expressions.
Hello All,
I have a script that will email out if the email address is specified as parameter 1.
I am using ksh, and then tried the following :
email=$1
Following did not work, I am getting error
test -z $email
test ${email:=" ") -eq " "
test -n $email
test ${?email}
What... (4 Replies)
I am making a script to check the parameters, but it seems that I can't catch the parameters by loop.
$ cat sendmsg.sh
#!/bin/sh
## Parameter Check
i=0
max=$#
while
do
PARAM=$${i}
i=`expr ${i} + 1`
echo ${PARAM}
done
How can I get the $1, $2, $3 by loop and set their... (2 Replies)
I need to pass a parameter to a function in a script. My parameter is a string. When I display the parameter within my function, I only get the first word from string I pass in.
How can I make the function receive the whole string (and not terminate at the first space it encounters)?.
part of... (1 Reply)
I have a "find {start} -ls" command listing all files and dirs in on the whole filesystem.
As part of this it lists locations that contain temporary files and, sometimes when executing, it identifies a file but produces an ERROR when trying to list it.
ERROR thrown: find: bad status--... (2 Replies)
Hi,
I have a parameter which is a string:
set parameter = "string"
I would like to compare it to various strings inside an IF conditional:
if ($parameter == "string") then
bla bla bla
endif
but it doesn't work, and I have no idea why.
Thanks in advance,
Shira. :) (12 Replies)
Hi all,
I have four (4) different UNIX flavours and I want to know whether the following commands are correct with respect to wanting to check on what are my current kernel parameter settings.
I just want to clear the doubts hanging over my head whether the commands below are the right ones... (2 Replies)
Hi all
i need to check that if user has passed any input parameter while executing he shell script like
./test1.sh -a"-v"
then do smothing
if user execute the script without giving input paramater then
./test1.sh
then do something
how can we check this input parameter (6 Replies)
Hey I'm new in linux,
I'm looking for a code to check whether the parameter is a number or a string.
I have already tried this code:
eerste=$(echo $1 | grep "^*$">aux)
if
But it doesn't work.:confused:
Thanks (2 Replies)
I have a code which is using to find duplicates in a files based on column.Below is the same code which is used to find duplicates in my file based on column 1
awk -F'|' '{if (x) { x_count++; print $0; if (x_count == 1) { print x } } x = $0}' FileName >Dup_File.txt
But my requirement here is... (3 Replies)
Discussion started by: ginrkf
3 Replies
LEARN ABOUT OSF1
chdir
chdir(2) System Calls Manual chdir(2)NAME
chdir, fchdir - Changes the current directory
SYNOPSIS
#include <unistd.h>
int chdir ( const char *path );
int fchdir ( int filedes );
STANDARDS
Interfaces documented on this reference page conform to industry standards as follows:
chdir(): XSH5.0
fchdir(): XSH5.0
Refer to the standards(5) reference page for more information about industry standards and associated tags.
PARAMETERS
Points to the pathname of the directory. Specifies the file descriptor of the directory.
DESCRIPTION
The chdir() function changes the current directory to the directory indicated by the path parameter.
The fchdir() function changes the current directory to the directory indicated by the filedes parameter. If the path parameter refers to a
symbolic link, thechdir() function sets the current directory to the directory pointed to by the symbolic link.
The current directory, also called the current working directory, is the starting point of searches for pathnames that do not begin with a
/ (slash). In order for a directory to become the current directory, the calling process must have search access to the directory.
NOTES
The current working directory is shared between all threads within the same process. Therefore, one thread using the chdir() or fchdir()
functions will affect every other thread in that process.
RETURN VALUES
Upon successful completion, the chdir() function returns a value of 0 (zero). Otherwise, a value of -1 is returned and errno is set to
indicate the error.
ERRORS
If the chdir() function fails, the current directory remains unchanged and errno may be set to one of the following values: Search access
is denied for any component of the pathname. The path parameter points outside the process's allocated address space. An I/O error
occurred while reading from or writing to the file system. Too many symbolic links were encountered in translating the pathname. The
length of the path argument exceeds PATH_MAX or a pathname component is longer than NAME_MAX.
Pathname resolution of a symbolic link produced an intermediate result whose length exceeds PATH_MAX. The named directory does not
exist, or is an empty string. A component of the path prefix is not a directory.
If the fchdir() function fails, the current directory remains unchanged and errno may be set to one of the following values: The filedes
parameter is not a valid open file descriptor. The file descriptor does not reference a directory.
RELATED INFORMATION
Functions: chroot(2)
Commands: cd(1)
Standards: standards(5) delim off
chdir(2)