Sponsored Content
Full Discussion: Whats wrong with my script?
Top Forums Shell Programming and Scripting Whats wrong with my script? Post 302471910 by vsekvsek on Monday 15th of November 2010 03:21:32 PM
Old 11-15-2010
Thanks for respones. I changed it to below. I now get an output of blank line followed by "TEST". So my memSize variable apparently gets modified but never displays. Am I doing something still wrong here?
Code:
#!/bin/sh    
test="TEST";
memSize="TEST2";
memSize=`grep '^256' LoaderMemorySettings.properties | cut -d= -f 2`;
echo $memSize
echo $test


Last edited by Scott; 11-15-2010 at 04:53 PM.. Reason: Code tags
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Whats wrong with this 5 line script!

Hi #!/bin/sh user=$1 if " -eq 0 ] echo "No" else echo "Yes" fi I'm not quite sure whats wrong with this but I know its something silly. Any ideas? Thanks (9 Replies)
Discussion started by: c19h28O2
9 Replies

2. Shell Programming and Scripting

Whats wrong with this script?

Hi all, #!/bin/ksh BIN=/interface/Gunner age=$1 directory="$2" && directory=. cd "$directory" || exit 1 from=`$BIN/today -$age` cd $BIN for i in `cat filestoarchive.txt`;do cd $i find . -mtime 14 | grep -v '.tar$' | $BIN/dttmfilter | awk '$1<="'$from'"{ print;};' | \ done (2 Replies)
Discussion started by: kayarsenal
2 Replies

3. UNIX for Advanced & Expert Users

Whats wrong in this Script ???

PATH="/clocal/mqbrkrs/user/mqsiadm/sanjay" MAIL_RECIPIENTS="xyz@abc.com" Subject="File accessed in last minutes:" find $PATH -type f -amin -1 > temp.txt.$$ cat temp.txt.$$ | \ while read line do fuser -uV $line >> tempmail.txt done cat "$tempmail.txt" | mailx -s "$Subject"... (4 Replies)
Discussion started by: varungupta
4 Replies

4. Shell Programming and Scripting

tell me whats wrong in this?

#! /bin/bash head -5 $1 echo "remove $1 ?" read answer if then echo invalid answer elif rm $1 echo "$1 is deleted" elif then echo file is not deleted else echo "invalid answer" fi What i really want this to do is to ask to delete the file or not..it says something wrong... (1 Reply)
Discussion started by: nadman123
1 Replies

5. Shell Programming and Scripting

tell me whats wrong with this

#! /bin/bash USAGE=" | ] if then echo "$USAGE" exit 1 fi while getopts lb: OPTION do case $(OPTION)in a) echo Hi there! exit 2;; b) echo hello o) OARG=$OPTARG;; \?)echo "$USAGE" ;; exit 2;; esac done shift `expr... (1 Reply)
Discussion started by: nadman123
1 Replies

6. UNIX for Dummies Questions & Answers

Whats wrong in the script?

if then if then echo "fst argument is $1 " else if then "fst argument is $1" fi fi fi Can anyone tell me. My requirement is tht pass a string .. Check whether it contains "-". If yes then check if it... (1 Reply)
Discussion started by: nehagupta2008
1 Replies

7. OS X (Apple)

Whats wrong with this shell script!!!!!

hi guys can you tell me if anything is wrong with this script, seems reasonable to me but somehow never works. Script redacted for being too explicit (2 Replies)
Discussion started by: Freddo
2 Replies

8. Homework & Coursework Questions

Whats wrong with the following

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: ls -ld htdocs drwxr-x--- 3 root root 8192 2006-11-19 10:41 htdocs How would a host administrator... (1 Reply)
Discussion started by: Larry_1
1 Replies

9. UNIX for Dummies Questions & Answers

Whats wrong with this if-else

hi whats wrong in below?? CHECK=M10; if ; then echo "hello hi"; else echo "how are u hello hi"; fi I am getting error as ./test.sh: line 2: ' ./test.sh: line 2: M10: command not found ./test.sh: line 2: M10: command not found ./test.sh: line 2: M10: command not found (8 Replies)
Discussion started by: skyineyes
8 Replies

10. Shell Programming and Scripting

Sh Script whats wrong?

Hi there, i have a problem i have created followning sh files some years ago but now it dosen`t work anymore i never used it a long time. Can anyone find the Error? Its always runs the stop() block and trying to Killing the Server also if i try to start or creat a new one. #!/bin/sh stop()... (6 Replies)
Discussion started by: NewCannon
6 Replies
ici::doc::pod3::memmgr(3)				       ICI library functions					 ici::doc::pod3::memmgr(3)

NAME
memmgr - memory manager abstraction functions SYNOPSIS
#include "memmgr.h" typedef void *(* MemAllocator) (char *fileName, int lineNbr, size_t size); typedef void (* MemDeallocator) (char *fileName, int lineNbr, void * blk); typedef void *(* MemAtoPConverter) (unsigned int address); typedef unsigned int (* MemPtoAConverter) (void * pointer); unsigned int memmgr_add (char *name, MemAllocator take, MemDeallocator release, MemAtoPConverter AtoP, MemPtoAConverter PtoA); int memmgr_find (char *name); char *memmgr_name (int mgrId); MemAllocator memmgr_take (int mgrId); MemDeallocator memmgr_release (int mgrId); MemAtoPConverter memmgr_AtoP (int mgrId); MemPtoAConverter memmgr_PtoA (int mgrId; int memmgr_open (int memKey, unsigned long memSize, char **memPtr, int *smId, char *partitionName, PsmPartition *partition, int *memMgr, MemAllocator afn, MemDeallocator ffn, MemAtoPConverter apfn, MemPtoAConverter pafn); void memmgr_destroy (int smId, PsmPartition *partition); DESCRIPTION
"memmgr" is an abstraction layer for administration of memory management. It enables multiple memory managers to coexist in a single application. Each memory manager specification is required to include pointers to a memory allocation function, a memory deallocation function, and functions for translating between local memory pointers and "addresses", which are abstract memory locations that have private meaning to the manager. The allocation function is expected to return a block of memory of size "size" (in bytes), initialized to all binary zeroes. The fileName and lineNbr arguments to the allocation and deallocation functions are expected to be the values of __FILE__ and __LINE__ at the point at which the functions are called; this supports any memory usage tracing via sptrace(3) that may be implemented by the underlying memory management system. Memory managers are identified by number and by name. The identifying number for a memory manager is an index into a private, fixed-length array of up to 8 memory manager configuration structures; that is, memory manager number must be in the range 0-7. However, memory manager numbers are assigned dynamically and not always predictably. To enable multiple applications to use the same memory manager for a given segment of shared memory, a memory manager may be located by a predefined name of up to 15 characters that is known to all the applications. The memory manager with manager number 0 is always available; its name is "std". Its memory allocation function is calloc(), its deallocation function is free(), and its pointer/address translation functions are merely casts. unsigned int memmgr_add(char *name, MemAllocator take, MemDeallocator release, MemAtoPConverter AtoP, MemPtoAConverter PtoA) Add a memory manager to the memory manager array, if not already defined; attempting to add a previously added memory manager is not considered an error. name is the name of the memory manager. take is a pointer to the manager's memory allocation function; release is a pointer to the manager's memory deallocation function. AtoP is a pointer to the manager's function for converting an address to a local memory pointer; PtoA is a pointer to the manager's pointer-to-address converter function. Returns the memory manager ID number assigned to the named manager, or -1 on any error. NOTE: memmgr_add() is NOT thread-safe. In a multithreaded execution image (e.g., VxWorks), all memory managers should be loaded before any subordinate threads or tasks are spawned. int memmgr_find(char *name) Return the memmgr ID of the named manager, or -1 if not found. char *memmgr_name(int mgrId) Return the name of the manager given by mgrId. MemAllocator memmgr_take(int mgrId) Return the allocator function pointer for the manager given by mgrId. memDeallocator memmgr_release(int mgrId) Return the deallocator function pointer for the manager given by mgrId. MemAtoPConverter memmgr_AtoP(int mgrId) Return the address-to-pointer converter function pointer for the manager given by mgrId. MemPtoAConverter memmgr_PtoA(int mgrId) Return the pointer-to-address converter function pointer for the manager given by mgrId. int memmgr_open(int memKey, unsigned long memSize, char **memPtr, int *smId, char *partitionName, PsmPartition *partition, int *memMgr, MemAllocator afn, MemDeallocator ffn, MemAtoPConverter apfn, MemPtoAConverter pafn); memmgr_open() opens one avenue of access to a PSM managed region of shared memory, initializing as necessary. In order for multiple tasks to share access to this memory region, all must cite the same memkey and partitionName when they call memmgr_open(). If shared access is not necessary, then memKey can be SM_NO_KEY and partitionName can be any valid partition name. If it is known that a prior invocation of memmgr_open() has already initialized the region, then memSize can be zero and memPtr must be NULL. Otherwise memSize is required and the required value of memPtr depends on whether or not the memory that is to be shared and managed has already been allocated (e.g., it's a fixed region of bus memory). If so, then the memory pointer variable that memPtr points to must contain the address of that memory region. Otherwise, *memPtr must contain NULL. memmgr_open() will allocate system memory as necessary and will in any case return the address of the shared memory region in *memPtr. If the shared memory is newly allocated or otherwise not yet under PSM management, then memmgr_open() will invoke psm_manage() to manage the shared memory region. It will also add a catalogue for the managed shared memory region as necessary. If memMgr is non-NULL, then memmgr_open() will additionally call memmgr_add() to establish a new memory manager for this managed shared memory region, as necessary. The index of the applicable memory manager will be returned in memMgr. If that memory manager is newly created, then the supplied afn, ffn, apfn, and pafn functions (which can be written with reference to the memory manager index value returned in memMgr) have been established as the memory management functions for local private access to this managed shared memory region. Returns 0 on success, -1 on any error. void memmgr_destroy(int smId, PsmPartition *partition); memmgr_destroy() terminates all access to a PSM managed region of shared memory, invoking psm_erase() to destroy the partition and sm_ShmDestroy() to destroy the shared memory object. EXAMPLE
/* this example uses the calloc/free memory manager, which is * called "std", and is always defined in memmgr. */ #include "memmgr.h" main() { int mgrId; MemAllocator myalloc; MemDeallocator myfree; char *newBlock; mgrId = memmgr_find("std"); myalloc = memmgr_take(mgrId); myfree = memmgr_release(mgrId); ... newBlock = myalloc(5000); ... myfree(newBlock); } SEE ALSO
psm(3) perl v5.14.2 2012-05-25 ici::doc::pod3::memmgr(3)
All times are GMT -4. The time now is 02:03 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy