Sponsored Content
Top Forums Shell Programming and Scripting Syntax error: Unterminated quoted string Post 302297485 by evilSerph on Friday 13th of March 2009 02:49:51 PM
Old 03-13-2009
another thing, I can't seem to get the following to appear
Total = `expr $Total + $num1`

besides that i need it to loop intil the final value reaches higher than 1000

If anyone could help, again it would be much appreciated.
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Unterminated string

While running a shell script i am getting this warning but the script is working fine.while running the blocks of the scripts individually its running fine.But while pasting it combinedly this is the warning..wat may be the reason behind this and how to resolve it (3 Replies)
Discussion started by: dr46014
3 Replies

2. Shell Programming and Scripting

how to delete blanks inside a quoted string

Hi I need to update a string inside a file which looks like the following: PX_LIST=" 4119 2390 2294 2776 2897 4099 " Is there a way to get rid of the blanks after the first quote mark and before the last quote mark. This needs to be done ONLY for the string named PX_LIST (there are some... (4 Replies)
Discussion started by: aoussenko
4 Replies

3. Shell Programming and Scripting

Unterminated quoted string

Hello! I wroted a little script that should check for new updates on a server and get them if any. The problem is, every time I run it with sh, I'm getting an "script: 20: Syntax error: Unterminated quoted string" error! The problem is, there isn't any "unterminated quoted string" in my script:... (2 Replies)
Discussion started by: al0x
2 Replies

4. Shell Programming and Scripting

Take quoted output from one script as quoted input for another script

Hi, I have a script output.sh which produces the following output (as an example): "abc def" "ghi jkl" This output should be handled from script input.sh as input and the quotes should be treated as variable delimiters but not as regular characters. input.sh (processing positional... (2 Replies)
Discussion started by: stresing
2 Replies

5. UNIX for Dummies Questions & Answers

sed error unterminated `s' command

I have list of data I have cut down to format: I am using sed command to remove the sed 's/ Returns error: sed: -e expression #1, char 5: unterminated `s' command Full code line is: cat textFile | cut -d ' ' -f 4 | cut ':' -f 1 | sed 's/ Thanks, Please use next time code tags... (2 Replies)
Discussion started by: maximus73
2 Replies

6. Shell Programming and Scripting

sed returns error "sed: -e expression #1, char 18: unterminated `s' command"

Hello All, I have something like below LDC100/rel/prod/libinactrl.a LAA2000/rel/prod/libinactrl.a I want to remove till first forward slash that is outputshould be as below rel/prod/libinactrl.a rel/prod/libinactrl.a How can I do that ??? (8 Replies)
Discussion started by: anand.shah
8 Replies

7. Shell Programming and Scripting

Deleting double quoted string from a line when line number is variable

I need to remove double quoted strings from specific lines in a file. The specific line numbers are a variable. For example, line 5 of the file contains A B C "string" I want to remove "string". The following sed command works: sed '5 s/\"*\"//' $file If there are multiple... (2 Replies)
Discussion started by: rennatsb
2 Replies

8. UNIX for Dummies Questions & Answers

Getting " Unterminated quoted string"

Hi Guys, When I am executing the script #! /bin/bash SARBACKUPS=/home/pradeep/sarBackups cd /var/log/sysstat ls -1t sar* | while read SARNAME do cp -p "$SARNAME" $( echo "$SARBACKUPS"/"$HOSTNAME"_"$SARNAME"_"`date +"%Y%m%d`.bkup ) done I am getting final.sh: 1: Syntax... (3 Replies)
Discussion started by: Pradeep_1990
3 Replies

9. Shell Programming and Scripting

Replace double quotes with a single quote within a double quoted string

Hi Froum. I have tried in vain to find a solution for this problem - I'm trying to replace any double quotes within a quoted string with a single quote, leaving everything else as is. I have the following data: Before: ... (32 Replies)
Discussion started by: pchang
32 Replies

10. Shell Programming and Scripting

awk string comparison unterminated quoted string andrule of thumb

I have the logic below to look up for matches within the columns between the two files with awk. In the if statement is where the string comparison is attempted with == The issue seems to be with the operands, as 1. when " '${SECTOR}' " -- double quote followed by single quote -- awk matches... (1 Reply)
Discussion started by: deadyetagain
1 Replies
MALLINFO(3)						     Linux Programmer's Manual						       MALLINFO(3)

NAME
mallinfo - obtain memory allocation information SYNOPSIS
#include <malloc.h> struct mallinfo mallinfo(void); DESCRIPTION
The mallinfo() function returns a copy of a structure containing information about memory allocations performed by malloc(3) and related functions. This structure is defined as follows: struct mallinfo { int arena; /* Non-mmapped space allocated (bytes) */ int ordblks; /* Number of free chunks */ int smblks; /* Number of free fastbin blocks */ int hblks; /* Number of mmapped regions */ int hblkhd; /* Space allocated in mmapped regions (bytes) */ int usmblks; /* Maximum total allocated space (bytes) */ int fsmblks; /* Space in freed fastbin blocks (bytes) */ int uordblks; /* Total allocated space (bytes) */ int fordblks; /* Total free space (bytes) */ int keepcost; /* Top-most, releasable space (bytes) */ }; The fields of the mallinfo structure contain the following information: arena The total amount of memory allocated by means other than mmap(2) (i.e., memory allocated on the heap). This figure includes both in-use blocks and blocks on the free list. ordblks The number of ordinary (i.e., non-fastbin) free blocks. smblks The number of fastbin free blocks (see mallopt(3)). hblks The number of blocks currently allocated using mmap(2). (See the discussion of M_MMAP_THRESHOLD in mallopt(3).) hblkhd The number of bytes in blocks currently allocated using mmap(2). usmblks The "highwater mark" for allocated space--that is, the maximum amount of space that was ever allocated. This field is maintained only in nonthreading environments. fsmblks The total number of bytes in fastbin free blocks. uordblks The total number of bytes used by in-use allocations. fordblks The total number of bytes in free blocks. keepcost The total amount of releasable free space at the top of the heap. This is the maximum number of bytes that could ideally (i.e., ignoring page alignment restrictions, and so on) be released by malloc_trim(3). CONFORMING TO
This function is not specified by POSIX or the C standards. A similar function exists on many System V derivatives, and was specified in the SVID. BUGS
Information is returned for only the main memory allocation area. Allocations in other arenas are excluded. See malloc_stats(3) and mal- loc_info(3) for alternatives that include information about other arenas. The fields of the mallinfo structure are typed as int. However, because some internal bookkeeping values may be of type long, the reported values may wrap around zero and thus be inaccurate. EXAMPLE
The program below employs mallinfo() to retrieve memory allocation statistics before and after allocating and freeing some blocks of mem- ory. The statistics are displayed on standard output. The first two command-line arguments specify the number and size of blocks to be allocated with malloc(3). The remaining three arguments specify which of the allocated blocks should be freed with free(3). These three arguments are optional, and specify (in order): the step size to be used in the loop that frees blocks (the default is 1, meaning free all blocks in the range); the ordinal position of the first block to be freed (default 0, meaning the first allocated block); and a number one greater than the ordinal position of the last block to be freed (default is one greater than the maximum block number). If these three arguments are omitted, then the defaults cause all allocated blocks to be freed. In the following example run of the program, 1000 allocations of 100 bytes are performed, and then every second allocated block is freed: $ ./a.out 1000 100 2 ============== Before allocating blocks ============== Total non-mmapped bytes (arena): 0 # of free chunks (ordblks): 1 # of free fastbin blocks (smblks): 0 # of mapped regions (hblks): 0 Bytes in mapped regions (hblkhd): 0 Max. total allocated space (usmblks): 0 Free bytes held in fastbins (fsmblks): 0 Total allocated space (uordblks): 0 Total free space (fordblks): 0 Topmost releasable block (keepcost): 0 ============== After allocating blocks ============== Total non-mmapped bytes (arena): 135168 # of free chunks (ordblks): 1 # of free fastbin blocks (smblks): 0 # of mapped regions (hblks): 0 Bytes in mapped regions (hblkhd): 0 Max. total allocated space (usmblks): 0 Free bytes held in fastbins (fsmblks): 0 Total allocated space (uordblks): 104000 Total free space (fordblks): 31168 Topmost releasable block (keepcost): 31168 ============== After freeing blocks ============== Total non-mmapped bytes (arena): 135168 # of free chunks (ordblks): 501 # of free fastbin blocks (smblks): 0 # of mapped regions (hblks): 0 Bytes in mapped regions (hblkhd): 0 Max. total allocated space (usmblks): 0 Free bytes held in fastbins (fsmblks): 0 Total allocated space (uordblks): 52000 Total free space (fordblks): 83168 Topmost releasable block (keepcost): 31168 Program source #include <malloc.h> #include "tlpi_hdr.h" static void display_mallinfo(void) { struct mallinfo mi; mi = mallinfo(); printf("Total non-mmapped bytes (arena): %d ", mi.arena); printf("# of free chunks (ordblks): %d ", mi.ordblks); printf("# of free fastbin blocks (smblks): %d ", mi.smblks); printf("# of mapped regions (hblks): %d ", mi.hblks); printf("Bytes in mapped regions (hblkhd): %d ", mi.hblkhd); printf("Max. total allocated space (usmblks): %d ", mi.usmblks); printf("Free bytes held in fastbins (fsmblks): %d ", mi.fsmblks); printf("Total allocated space (uordblks): %d ", mi.uordblks); printf("Total free space (fordblks): %d ", mi.fordblks); printf("Topmost releasable block (keepcost): %d ", mi.keepcost); } int main(int argc, char *argv[]) { #define MAX_ALLOCS 2000000 char *alloc[MAX_ALLOCS]; int numBlocks, j, freeBegin, freeEnd, freeStep; size_t blockSize; if (argc < 3 || strcmp(argv[1], "--help") == 0) usageErr("%s num-blocks block-size [free-step [start-free " "[end-free]]] ", argv[0]); numBlocks = atoi(argv[1]); blockSize = atoi(argv[2]); freeStep = (argc > 3) ? atoi(argv[3]) : 1; freeBegin = (argc > 4) ? atoi(argv[4]) : 0; freeEnd = (argc > 5) ? atoi(argv[5]) : numBlocks; printf("============== Before allocating blocks ============== "); display_mallinfo(); for (j = 0; j < numBlocks; j++) { if (numBlocks >= MAX_ALLOCS) fatal("Too many allocations"); alloc[j] = malloc(blockSize); if (alloc[j] == NULL) errExit("malloc"); } printf(" ============== After allocating blocks ============== "); display_mallinfo(); for (j = freeBegin; j < freeEnd; j += freeStep) free(alloc[j]); printf(" ============== After freeing blocks ============== "); display_mallinfo(); exit(EXIT_SUCCESS); } SEE ALSO
mmap(2), malloc(3), malloc_info(3), malloc_stats(3), malloc_trim(3), mallopt(3) Linux 2012-05-06 MALLINFO(3)
All times are GMT -4. The time now is 04:16 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy