This is the code:
while test 1 -eq 1
do
read a
$a
if test $a = stop
then
break
fi
done
I read a command on every loop an execute it.
I check if the string equals the word stop to end the loop,but it say that I gave too many arguments to test.
For example echo hello.
Now the... (1 Reply)
Hi,
I have written a script to compare 2 string values.. below is the script.. it throws an error - ./compare_str.sh: test: amount1|amount2: unknown operator..
as both are string values, I am using a = operator in the test command.
can some one help me figure out where the issue is?... (11 Replies)
Hi,
I am trying to write a small script that validates if there exist files that start with a pattern in a given directory. Below is the piece of my script:
#!/usr/bin/ksh
BTFDIR=/opt/ships/temp
if
then
echo 'found'
else
echo 'not found'
fi
When I run this... (2 Replies)
Hi,
I have the following script under bash
if ; then
echo File $file_name Not Found
else
echo File $file_name Found
fi
I get the message
even the file is found; there is only one file with that name in the directory
I can't figure... (4 Replies)
I want to make a script that check for the argument passed to it and generates an error in case any character/string argument passed to it.
I am using below code, but its not working. can anyone help.
#!/bin/bash
if ]; then
echo 'An integer argument is passed to the script hence... (3 Replies)
Hi All the Helpers!
I have a text file which looks like input.txt.I would request to please suggest me how can I make this file look like output.txt
input.txt
VOP 111 0 1 2
DEM 111 0 222 333 444 555
DEM 879 888 987 888 989
DEM 879 888 987 888 989
VOP 118 0 12 3 6... (7 Replies)
I have a following script to evaluate if file exist in the directory and then archive it.
#!/bin/bash
#master directory
scriptdir="/flex/sh/interfaces" #change this path only - all other paths are connected with it
filedir="/flex/interfaces" #change this path only - all other paths are... (3 Replies)
EDIT: Resolved
Resolved by changing the first line to bash rather than csh, does bash and csh treat the brackets differently?
Hi all,
I'm doing to some basic stuff to teach myself "if"
I've written the following:
#!/bin/csh
echo "This script checks for the test file"
... (1 Reply)
Discussion started by: Meshuggener
1 Replies
LEARN ABOUT SUNOS
realpath
realpath(3C) Standard C Library Functions realpath(3C)NAME
realpath - resolve pathname
SYNOPSIS
#include <stdlib.h>
char *realpath(const char *restrict file_name, char *restrict resolved_name);
DESCRIPTION
The realpath() function derives, from the pathname pointed to by file_name, an absolute pathname that names the same file, whose resolution
does not involve ".", "..", or symbolic links. The generated pathname is stored as a null-terminated string, up to a maximum of {PATH_MAX}
bytes (defined in limits.h(3HEAD)), in the buffer pointed to by resolved_name.
RETURN VALUES
On successful completion, realpath() returns a pointer to the resolved name. Otherwise, realpath() returns a null pointer and sets errno
to indicate the error, and the contents of the buffer pointed to by resolved_name are left in an indeterminate state.
ERRORS
The realpath() function will fail if:
EACCES Read or search permission was denied for a component of file_name.
EINVAL Either the file_name or resolved_name argument is a null pointer.
EIO An error occurred while reading from the file system.
ELOOP Too many symbolic links were encountered in resolving file_name.
ELOOP A loop exists in symbolic links encountered during resolution of the file_name argument.
ENAMETOOLONG The file_name argument is longer than {PATH_MAX} or a pathname component is longer than {NAME_MAX}.
ENOENT A component of file_name does not name an existing file or file_name points to an empty string.
ENOTDIR A component of the path prefix is not a directory.
The realpath() function may fail if:
ENAMETOOLONG Pathname resolution of a symbolic link produced an intermediate result whose length exceeds {PATH_MAX}.
ENOMEM Insufficient storage space is available.
USAGE
The realpath() function operates on null-terminated strings.
Execute permission is required for all the directories in the given and the resolved path.
The realpath() function might fail to return to the current directory if an error occurs.
ATTRIBUTES
See attributes(5) for descriptions of the following attributes:
+-----------------------------+-----------------------------+
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
+-----------------------------+-----------------------------+
|Interface Stability |Standard |
+-----------------------------+-----------------------------+
|MT-Level |MT-Safe |
+-----------------------------+-----------------------------+
SEE ALSO getcwd(3C), limits.h(3HEAD), sysconf(3C), attributes(5), standards(5)SunOS 5.10 9 Oct 2003 realpath(3C)