Sponsored Content
Top Forums Shell Programming and Scripting A dash to GOTO or a dash from GOTO, that is the question... Post 303039013 by wisecracker on Thursday 19th of September 2019 02:47:26 PM
Old 09-19-2019
Hi MadeInGermany...
(Hopefully this does not attach to the previous post.)

Copied and pasted your segment into my original code and it works well.

Thanks...

Bazza...
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

how to goto in ksh

Hi, I'm trying to use the goto in ksh but it does not appear to be a valid command. Is that only valid in csh? Anything similar in ksh that I can use? Appreciate any help you can provide. Thanks. geraldine (4 Replies)
Discussion started by: Geraldine
4 Replies

2. Shell Programming and Scripting

Use of GOTO statement in scripts

Hey Guys.. I just want to know how to use Goto statement in shell scripts. I know the basic use of statement. Goto Label The above statement will search for some label which must be defined in the script itself as: label: I tried these combinations but I didn't work out for me and I'm... (7 Replies)
Discussion started by: vikasduhan
7 Replies

3. Shell Programming and Scripting

goto statement

I have a test script for using goto statement but its not working. please help i tried both in linux and hp-ux it's not working please help #! /bin/ksh t=`ps -ef|grep ti.sh|grep -v grep` if ; then goto start else goto stop fi start: echo "start" stop: echo "stop" (5 Replies)
Discussion started by: Krrishv
5 Replies

4. UNIX for Dummies Questions & Answers

Stuck after typing goto

uname -a returns: SMP Tue May 17 17:52:23 EDT 2005 i686 athlon i386 GNU/Linux I have many aliases beginning with "goto" so... if I type goto and then hit return (oops) A goto prompt pops up and I cant exit from it(I tried MANY key seqs) The only way to exit is to kill the term window... (2 Replies)
Discussion started by: rairey
2 Replies

5. UNIX for Dummies Questions & Answers

dash after ampersant

Hi! I'm new in these forums and more or less new with Unix. So... here is the question: does anyone know where is redirected the output of a command when you put >&- after it? Does it means any standard file descriptor? Thanks! (2 Replies)
Discussion started by: csecnarf
2 Replies

6. Solaris

Goto last visted directory

Dear All, Can any one pls let me the command for how to goback to previous visited directory from the current working directory in SunOS ? In case of HP-UX; the same can be resolved through "cd -" command. Thanks in advance! Prasanth Babu. (6 Replies)
Discussion started by: prasanth_babu
6 Replies

7. Shell Programming and Scripting

remove dash

hi I am using ksh #A="abc-def" #typeset -u B="$A" #echo $B ABC-DEF how to remove the dash? i.e. ABCDEF? thank you (1 Reply)
Discussion started by: melanie_pfefer
1 Replies

8. Shell Programming and Scripting

Using A Goto Label?

Im trying to do something like this but I cant find any documentation. read X if then goto ThisLine fi OTHER CODE OTHER CODE Label: ThisLine echo "You entered 1" (5 Replies)
Discussion started by: Grizzly
5 Replies

9. Shell Programming and Scripting

Alternative for goto

#!/bin/sh label: echo sql poll v=`sqlplus -s <<! HR/HR set pages 0 echo off feed off select distinct status from emp where id=5; ! ` echo $v; echo it comes here after false if then echo if condition true sqlplus -l scott/tiger <<EOF select * from department; EXIT (2 Replies)
Discussion started by: kumaar1986
2 Replies

10. Ubuntu

Use of goto keyword in kernel programming

I have found many source files in the kernel using goto keyword instead of just doing the actual thing. For example: if(blah) goto x; -- -- -- -- -- x: return blah-blah Is there any specific reason for writing the code like this? The first thought that came to my mind is minimizing... (0 Replies)
Discussion started by: BHASKAR JUPUDI
0 Replies
SHMOP(2)						     Linux Programmer's Manual							  SHMOP(2)

NAME
shmat, shmdt - shared memory operations SYNOPSIS
#include <sys/types.h> #include <sys/shm.h> void *shmat(int shmid, const void *shmaddr, int shmflg); int shmdt(const void *shmaddr); DESCRIPTION
shmat() attaches the shared memory segment identified by shmid to the address space of the calling process. The attaching address is spec- ified by shmaddr with one of the following criteria: If shmaddr is NULL, the system chooses a suitable (unused) address at which to attach the segment. If shmaddr isn't NULL and SHM_RND is specified in shmflg, the attach occurs at the address equal to shmaddr rounded down to the nearest multiple of SHMLBA. Otherwise shmaddr must be a page-aligned address at which the attach occurs. If SHM_RDONLY is specified in shmflg, the segment is attached for reading and the process must have read permission for the segment. Oth- erwise the segment is attached for read and write and the process must have read and write permission for the segment. There is no notion of a write-only shared memory segment. The (Linux-specific) SHM_REMAP flag may be specified in shmflg to indicate that the mapping of the segment should replace any existing map- ping in the range starting at shmaddr and continuing for the size of the segment. (Normally an EINVAL error would result if a mapping already exists in this address range.) In this case, shmaddr must not be NULL. The brk(2) value of the calling process is not altered by the attach. The segment will automatically be detached at process exit. The same segment may be attached as a read and as a read-write one, and more than once, in the process's address space. A successful shmat() call updates the members of the shmid_ds structure (see shmctl(2)) associated with the shared memory segment as fol- lows: shm_atime is set to the current time. shm_lpid is set to the process-ID of the calling process. shm_nattch is incremented by one. shmdt() detaches the shared memory segment located at the address specified by shmaddr from the address space of the calling process. The to-be-detached segment must be currently attached with shmaddr equal to the value returned by the attaching shmat() call. On a successful shmdt() call the system updates the members of the shmid_ds structure associated with the shared memory segment as follows: shm_dtime is set to the current time. shm_lpid is set to the process-ID of the calling process. shm_nattch is decremented by one. If it becomes 0 and the segment is marked for deletion, the segment is deleted. After a fork(2) the child inherits the attached shared memory segments. After an execve(2) all attached shared memory segments are detached from the process. Upon _exit(2) all attached shared memory segments are detached from the process. RETURN VALUE
On success shmat() returns the address of the attached shared memory segment; on error (void *) -1 is returned, and errno is set to indi- cate the cause of the error. On success shmdt() returns 0; on error -1 is returned, and errno is set to indicate the cause of the error. ERRORS
When shmat() fails, errno is set to one of the following: EACCES The calling process does not have the required permissions for the requested attach type, and does not have the CAP_IPC_OWNER capa- bility. EINVAL Invalid shmid value, unaligned (i.e., not page-aligned and SHM_RND was not specified) or invalid shmaddr value, or can't attach seg- ment at shmaddr, or SHM_REMAP was specified and shmaddr was NULL. ENOMEM Could not allocate memory for the descriptor or for the page tables. When shmdt() fails, errno is set as follows: EINVAL There is no shared memory segment attached at shmaddr; or, shmaddr is not aligned on a page boundary. CONFORMING TO
SVr4, POSIX.1-2001. In SVID 3 (or perhaps earlier) the type of the shmaddr argument was changed from char * into const void *, and the returned type of shmat() from char * into void *. (Linux libc4 and libc5 have the char * prototypes; glibc2 has void *.) NOTES
Using shmat() with shmaddr equal to NULL is the preferred, portable way of attaching a shared memory segment. Be aware that the shared memory segment attached in this way may be attached at different addresses in different processes. Therefore, any pointers maintained within the shared memory must be made relative (typically to the starting address of the segment), rather than absolute. On Linux, it is possible to attach a shared memory segment even if it is already marked to be deleted. However, POSIX.1-2001 does not specify this behavior and many other implementations do not support it. The following system parameter affects shmat(): SHMLBA Segment low boundary address multiple. Must be page aligned. For the current implementation the SHMLBA value is PAGE_SIZE. The implementation places no intrinsic limit on the per-process maximum number of shared memory segments (SHMSEG). SEE ALSO
brk(2), mmap(2), shmctl(2), shmget(2), capabilities(7), shm_overview(7), svipc(7) COLOPHON
This page is part of release 3.27 of the Linux man-pages project. A description of the project, and information about reporting bugs, can be found at http://www.kernel.org/doc/man-pages/. Linux 2008-06-03 SHMOP(2)
All times are GMT -4. The time now is 11:22 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy