Sponsored Content
Top Forums Shell Programming and Scripting The last argument contains spaces, how do I get it into a variable? Post 302567380 by zagga on Monday 24th of October 2011 05:51:30 AM
Old 10-24-2011
Sorry Franklin52 that doesn't seem to work:

Case 1:
if both $14 and 15 are null ie full of spaces.
I get Arg14=" " and Arg15 has nothing.

Case 2:
if $14="3333" and $15 is null
I get Arg14="3333" and Arg15 has nothing.

Case 3:
if $14 is null ie " " and $15 contains "12345678901234567890123456789012345678901234567890"
I get Arg14="1234" and Arg15="567890......"

Case 4:
If $14="9999" and $15="one two three four five six seven ....."
I get Arg14="9999" and Arg15=

I think I need to create an intermediary variable and get everything from the end of $13 into it.

I'm not sure I've made myself clear.

Thanks in advance

Zagga

---------- Post updated at 11:51 AM ---------- Previous update was at 11:39 AM ----------

The reply I just posted may have been a little misleading as I quoted ARG14 but not ARG15. so output looked different. As it turns out Case 1 and 2 give expected results. Case 3 and 4 don't.
Zagga
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Passing the command line argument in a variable

Hi, I am new to unix. Is their a way to pass the output of the line below to a variable var1. ls -1t | head -1. I am trying something like var1=ls -1t | head -1, but I get error. Situation is: I get file everyday through FTP in my unix box. I have to write a script that picks up first... (1 Reply)
Discussion started by: rkumar28
1 Replies

2. Shell Programming and Scripting

Strip leading and trailing spaces only in a shell variable with embedded spaces

I am trying to strip all leading and trailing spaces of a shell variable using either awk or sed or any other utility, however unscuccessful and need your help. echo $SH_VAR | command_line Syntax. The SH_VAR contains embedded spaces which needs to be preserved. I need only for the leading and... (6 Replies)
Discussion started by: jerardfjay
6 Replies

3. Shell Programming and Scripting

problem with spaces and argument parsing

public class HelloWorld { public static void main(String args) { System.out.println("Welcome, master"); } } and I compiled using javac HelloWorld.java ] Suppose that I execute the following command directly from the shell: java -XX:OnError="gdb - %p" HelloWorld Then it works... (8 Replies)
Discussion started by: fabulous2
8 Replies

4. Shell Programming and Scripting

how to assign script argument to a variable

I have a script file. test.sh I am running it by command sh test.sh 10102004 where 10102004 is the script argument. I wan to assign this 10102004 to a variable. How can i do this? I tried &1 and awks ARGV its not working :( (2 Replies)
Discussion started by: rohankit
2 Replies

5. Shell Programming and Scripting

about an argument with variable in sed

hi all let say I run the ./xxx.bash x x x x or ./xxx.bash x x x or ./xxx.bash x x x x x the last argument always a filename the last arugment filename format is 5-10-22.txt my question is how can I put this arugment into variable and I can use it in sed or any other way that i can use I... (1 Reply)
Discussion started by: yuesko
1 Replies

6. Shell Programming and Scripting

Pass command line argument to variable

Hi, I had written a shell script to pass command line argument to variable in a function. Here is my code: main if ; then .$1 echo $1 get_input_file else echo "input file $1 is not available" fi get_input_file() { FILE = "$1" echo $FILE } (10 Replies)
Discussion started by: Poonamol
10 Replies

7. Shell Programming and Scripting

pass variable as sar argument

I am trying to get the details of iowait for last hour using sar. When I give date as argument it works. # sar -u -s 22:24:00 -e 23:24:00 Linux 2.6.35.13-26 (XX.server.com) 04/11/2012 10:30:03 PM CPU %user %nice %system %iowait %idle 10:40:04 PM all 5.03 ... (2 Replies)
Discussion started by: anil510
2 Replies

8. Shell Programming and Scripting

Variable passed as argument

I have a script. #!/bin/sh cur_$1_modify_time=Hello echo "cur_$1_modify_time" When I run like sh /root/script1 jj I expect value "Hello" being assigned to variable "cur_jj_modify_time" and output being "Hello" ie echoing $cur_jj_modify_time But the output comes as # sh... (3 Replies)
Discussion started by: anil510
3 Replies

9. Shell Programming and Scripting

Passing variable as an argument to another script

Hi, I am trying to pass a variable as an argument to another script. While substitution of variable, I am facing a problem. varaiable "a" value should be -b "FPT MAIN". When we pass "a" to another script, we are expecing it to get substitue as ./test.sh -b "FPT MAIN". But, it is getting... (9 Replies)
Discussion started by: Manasa Pradeep
9 Replies

10. Shell Programming and Scripting

Check for spaces in input argument!

Hi guys, I have created a csh script which allows user to pass input argument with the script like: cluster_on_lev3.csh -t <value> -p <value> Example: cluster_on_lev3.csh -t 2.3 -p 0.05 Now I want to create an error code where if user passes input argument without spaces , the code... (16 Replies)
Discussion started by: dixits
16 Replies
Image::LibRSVG(3pm)					User Contributed Perl Documentation				       Image::LibRSVG(3pm)

NAME
Image::LibRSVG - Perl extension for librsvg SYNOPSIS
use Image::LibRSVG; ## static Methods my $known_formats = Image::LibRSVG->getKnownFormats(); my $formats = Image::LibRSVG->getSupportedFormats(); my $isSupported = Image::LibRSVG->isFormatSupported("tiff"); my $rsvg = new Image::LibRSVG(); $rsvg->convert("my.svg", "my.png" ); $rsvg->convertAtZoom("my.svg", "my.png", 1.5, 1.5 ); $rsvg->convertAtMaxSize("my.svg", "my.png", 200, 300 ); $rsvg->convertAtSize("my.svg", "my.png", 200, 300 ); $rsvg->convertAtZoomWithMax("my.svg", "my.png", 1.5, 1.5, 200, 300 ); $formats = $rsvg->getSupportedFormats(); $isSupported = $rsvg->isFormatSupported("tiff"); $rsvg->loadImage( "my.svg" ); open( SVGFILE, "< my.svg" ); local( $/ ) ; $rsvg->loadImageFromString( <SVGFILE> ); close SVGFILE; $rsvg->saveAs( "my.png" ); $rsvg->saveAs( "my.jpg", "jpeg" ); $rsvg->loadImage( "my.svg", 0, { zoom => [ 1.5, 1.5 ] } ); $rsvg->saveAs( "zoomed.png" ); my $bitmap = $rsvg->getImageBitmap(); ABSTRACT
This module provides an Perl-Interface towards the gnome-lib librsvg-2. DESCRIPTION
This module provides an Perl-Interface towards the gnome-lib librsvg-2 which is able to convert SVG(Scaleable Vector Graphics) into bitmapformats like (PNG,JPG,...). To which formats you can convert the svg-files depends on your gdk-pixbuf configuration. Still at least PNG and JPG should be available. EXPORT None by default. Methods Constructor o new() static methods o ArrayRef getKnownFormats() returns all formats known to gdk-pixbuf o ArrayRef getSupportedFormats() returns all formats you can store your svg image into o bool isFormatSupported( String format ) returns true if you can store your image in this format else false member methods o bool loadImage( String svgfile[, int dpi=0, HashRef args] ) This is function provides a common call mechanism to for all functions below, the args-variable can hold the following values: Case 1( = loadFromFile ): undef Case 2( = loadFromFile ): empty hashref Case 3( = loadFromFileAtZoom ) zoom->[0] ... x_zoom zoom->[1] ... y_zoom Case 4( = loadFromFileAtMaxSize ): dimension->[0] ... x-size dimension->[1] ... y-size Case 5( = loadFromFileAtSize ): dimension->[0] ... x-size dimension->[1] ... y-size dimension->[2] ... max-size-flag Case 6( = loadFromFileAtZoomWithMax ): zoom->[0] ........ x_zoom zoom->[1] ........ y_zoom dimension->[0] ... x-size dimension->[1] ... y-size o bool loadImageFromString( String svgfile[, int dpi=0, HashRef args] ) Loads the image from an String containing a plain SVG. For information about args see loadImage. o bool loadFromFile(String svgfile,[int dpi=0]) o bool loadFromFileAtZoom( String svgfile, double x_zoom, double y_zoom[, int dpi=0] ) o bool loadFromFileAtMaxSize( String svgfile, int width, int height[, int dpi=0] ) o bool loadFromFileAtSize( String svgfile, int width, int height[, int dpi=0] ) o bool loadFromFileAtZoomWithMax( String svgfile, double x_zoom, double y_zoom, int width, int height[, int dpi=0] ) o bool loadFromString(String svgfile,[int dpi=0]) o bool loadFromStringAtZoom( String svgfile, double x_zoom, double y_zoom[, int dpi=0] ) o bool loadFromStringAtMaxSize( String svgfile, int width, int height[, int dpi=0] ) o bool loadFromStringAtSize( String svgfile, int width, int height[, int dpi=0] ) o bool loadFromStringAtZoomWithMax( String svgfile, double x_zoom, double y_zoom, int width, int height[, int dpi=0] ) o bool convert( String svgfile, String bitmapfile[, int dpi=0, String format="png", int quality=100] ) o bool convertAtZoom( String svgfile, String bitmapfile, double x_zoom, double y_zoom[, int dpi=0, String format="png", int quality=100] ) o bool convertAtMaxSize( String svgfile, String bitmapfile, int width, int height[, int dpi=0, String format="png", int quality=100] ) o bool convertAtSize( String svgfile, String bitmapfile, int width, int height[, int dpi=0, String format="png", int quality=100] ) o bool convertAtZoomWithMax( String svgfile, String bitmapfile, double x_zoom, double y_zoom, int width, int height[, int dpi=0, String format="png", int quality=100] ) o bool saveAs( String filename, [ String type, String quality ] ) Saves the image to a file o SV getBitmap( [ String type, String quality ] ) Saves the image to a scalar which can be passed on to other applications. This only return a useful value if you have compiled it with a gdk-pixbuf greater than or equal to 2.4 SEE ALSO
http://librsvg.sf.net AUTHOR
Tom Schindl, <tom.schindl@bestsolution.at> COPYRIGHT AND LICENSE
Copyright 2004 by Tom Schindl and bestsolution Systemhaus GmbH This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.14.2 2006-03-14 Image::LibRSVG(3pm)
All times are GMT -4. The time now is 05:28 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy