I have a situation where I want the user to enter only numbers in response to a READ command. I have some validation to restrict the number to be between 1 and 12, but if the user type in some characters the script echoes some error message and goes to the next command. Below is a snippet of the... (1 Reply)
Hello,
I have a command that I need to supply a negative number as a parameter; how do I do this? I have tried giving it with double quotes, "", but no avail.
Thanks,
Gussi (3 Replies)
All,
I know this question has been asked , but mine is different scenario
I am unsing HP unix, trying to transfer HP-Unix to HP-Unix.
I am transfering a bunch of file form machine1 to machine2. when i intiate my FTP script the files are getting transfered from machine1 to machine2.... (7 Replies)
I have a file with the information shown and I want to capture the
entry having the rgdt tag and taking the value (the location of the represents the decimal point, for example 0p50 represents 0.50)
I then want to divide the number at the end of each line by the value 0.50
I want to do... (7 Replies)
I need an awk script that returns the 1st field of the line in the middle of a file. For example, if a file I have has 6 lines, I want it to return the 1st field on line number 3. If a file has 7 lines, I want the script to return the 1st field on line number 4.
File1:
3 214
4 219
5 226
2... (8 Replies)
I have the following input:
xxxx-2.7.19_WR3
I have extract the following:
2.7.19
Can anyone suggest an awk or sed command to do the above...:confused:
another condition is
if the input is :
xxx-xxx_xxx-1.4-1_WR3.0bg.armv6jel_vfp
it shud still extract : 1.4-1
whenever "-"... (12 Replies)
Can any body help me to find out the logic
I have a script chkcomponent.pl Which give some output
Like
component1 userid: u1
component2 userid: u2
component3 userid: u1
.
.
#The no of components are different in different times run
Now I want this chkcomponent.pl script... (1 Reply)
I have created a shell scrit to run the informatica workflows sequentially.In the script i am executing 7 workflows sequentially after running 4 workflows the scrpt getting stop and it is not continuing next step evn it is updating logs.4th workflow will take more time to finish is that making... (1 Reply)
I have a file full of coordinates of the form:
37.68899917602539 58.07500076293945 57.79100036621094
The numbers don't always have the same number of decimal points. I need to reduce the decimal points of all the numbers (there are 128 rows of 3 numbers) to 2.
I have tried to do this... (2 Replies)
Discussion started by: crunchgargoyle
2 Replies
LEARN ABOUT NETBSD
setmode
SETMODE(3) BSD Library Functions Manual SETMODE(3)NAME
getmode, setmode -- modify mode bits
LIBRARY
Standard C Library (libc, -lc)
SYNOPSIS
#include <unistd.h>
void *
setmode(const char *mode_str);
mode_t
getmode(const void *set, mode_t mode);
DESCRIPTION
The setmode() function accepts a string representation of a file mode change, compiles it to binary form, and returns an abstract representa-
tion that may be passed to getmode(). The string may be an numeric (octal) or symbolic string of the form accepted by chmod(1), and may rep-
resent either an exact mode to set or a change to make to the existing mode.
The getmode() function adjusts the file permission bits given by mode according to the compiled change representation set, and returns the
adjusted mode. While only the permission bits are altered, other parts of the file mode, particularly the type, may be examined.
Because some of the possible symbolic values are defined relative to the file creation mask, setmode() may call umask(2), temporarily chang-
ing the mask. If this occurs, the file creation mask will be restored before setmode() returns. If the calling program changes the value of
its file creation mask after calling setmode(), setmode() must be called again to recompile the mode string if getmode() is to modify future
file modes correctly.
If the mode passed to setmode() is invalid, setmode() returns NULL.
EXAMPLES
The effects of the shell command 'chmod a+x myscript.sh' can be duplicated as follows:
const char *file = "myscript.sh";
struct stat st;
mode_t newmode;
stat(file, &st);
newmode = getmode(setmode("a+x"), st.st_mode);
chmod(file, newmode);
ERRORS
The setmode() function may fail and set errno for any of the errors specified for the library routines malloc(3) or strtol(3). In addition,
setmode() will fail and set errno to:
[EINVAL] The mode argument does not represent a valid mode.
SEE ALSO chmod(1), stat(2), umask(2), malloc(3)HISTORY
The getmode() and setmode() functions first appeared in 4.4BSD.
BUGS
Each call to setmode allocates a small amount of memory that there is no correct way to free.
The type of set should really be some opaque struct type used only by these functions rather than void *.
BSD January 4, 2009 BSD