Sponsored Content
Top Forums Shell Programming and Scripting bash: testing if string is a number Post 302080611 by vino on Wednesday 19th of July 2006 11:50:01 PM
Old 07-20-2006
If only you had searched the forums.... Smilie

How to check whether a string is number or not
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Testing the last character in a string

Hi In the shell scripted I'm trying to write! I would like to test the last character in a string. The string is a path/directory and I want to see if the last character is a '/'. The string (path/directory) is inputted by a user. If the '/' character isn't present then I want to be able to... (11 Replies)
Discussion started by: dbrundrett
11 Replies

2. Shell Programming and Scripting

Number/string format in bash

I would like to change the format of an integer type number adding zeros to the left of it in a script in bash. For example number=1 echo $number 00001 Thanks (3 Replies)
Discussion started by: josegr
3 Replies

3. Shell Programming and Scripting

how to format a number in bash

Say I have a number x=123, but I want to it be x=000123, because I need to use it in as a file name. thanks! (2 Replies)
Discussion started by: aerosols
2 Replies

4. Shell Programming and Scripting

changing number in bash (number is in form of string)

I have a txt file as database. when i run my program what it does is it ask me for 3 name and stored in the file as name1:name2:name3:1 when u enter 3 name it add those in file as above format and add 1 at the end. I what i want is if i enter same names again it changes that 1 to 2 and so... (3 Replies)
Discussion started by: Learnerabc
3 Replies

5. Shell Programming and Scripting

bash script for testing existence of files/folders and creating if neither exist

Hi, I am new to shell-scripting, and doing a lot of reading. I am having some trouble getting started with a simple testing of scripting. I have been experimenting with if, loops, for, test, etc., but still unsure. I seem to have the hang of it when it comes to creating a single file or... (6 Replies)
Discussion started by: me2
6 Replies

6. UNIX for Dummies Questions & Answers

Testing for non-zero length string

Hello, can someone please explain to me why this happens: myserver#echo "$nothing" myserver#if ; then echo "nothing is a zero length string"; fi nothing is a zero length string myserver#if ; then echo "nothing is also a non-zero length string, apparently"; fi nothing is also a non-zero... (5 Replies)
Discussion started by: longjon
5 Replies

7. Shell Programming and Scripting

Incrementing number in bash

I have the following code and getting the error ./raytrac.bash: line 231: ((: 0++: syntax error: operand expected (error token is "+") iarg = 0 iarg=0 narg=$# # Number of arguments passed. echo "narg = $narg" argsArr=("$@") # Set... (1 Reply)
Discussion started by: kristinu
1 Replies

8. Shell Programming and Scripting

Testing the length of a string

Hello, Unix-Forums! Is there a command that can check how long a user-entered string is? Please don't give me a code, just the name of the command (playing around yourself is much more fun than just pasting code) edit: I'm sorry, first hit of the forum search gave me the answer. (1 Reply)
Discussion started by: intelinside
1 Replies

9. UNIX for Beginners Questions & Answers

Escape bash-special character in a bash string

Hi, I am new in bash scripting. In my work, I provide support to several users and when I connect to their computers I use the same admin and password, so I am trying to create a script that will only ask me for the IP address and then connect to the computer without having me to type the user... (5 Replies)
Discussion started by: arcoa05
5 Replies

10. UNIX for Beginners Questions & Answers

Concatenate a string and number and compare that with another string in awk script

I have below code inside my awk script if ( $0 ~ /SVC IN:/ ) { svc_in=substr( $0,23 , 3); if (msg_start == 1 && msg_end == 0) { msg_arr=$0; } } else if ( $0 ~ /^SVC OUT:/ ) { svc_out=substr( $0, 9, 3); if (msg_start == 1 && msg_end == 0) ... (6 Replies)
Discussion started by: bhagya123
6 Replies
HTTP_BUILD_URL(3)							 1							 HTTP_BUILD_URL(3)

http_build_url - Build a URL

SYNOPSIS
string http_build_url ([mixed $url], [mixed $parts], [int $flags = HTTP_URL_REPLACE], [array &$new_url]) DESCRIPTION
Build a URL. The parts of the second URL will be merged into the first according to the flags argument. PARAMETERS
o $url - (part(s) of) a URL in form of a string or associative array like parse_url(3) returns o $parts - same as the first argument o $flags - a bitmask of binary or'ed HTTP_URL constants; HTTP_URL_REPLACE is the default o $new_url - if set, it will be filled with the parts of the composed url like parse_url(3) would return RETURN VALUES
Returns the new URL as string on success or FALSE on failure. EXAMPLES
Example #1 A http_build_url(3) example <?php echo http_build_url("http://user@www.example.com/pub/index.php?a=b#files", array( "scheme" => "ftp", "host" => "ftp.example.com", "path" => "files/current/", "query" => "a=c" ), HTTP_URL_STRIP_AUTH | HTTP_URL_JOIN_PATH | HTTP_URL_JOIN_QUERY | HTTP_URL_STRIP_FRAGMENT ); ?> The above example will output: ftp://ftp.example.com/pub/files/current/?a=c SEE ALSO
parse_url(3), http_build_str(3). PHP Documentation Group HTTP_BUILD_URL(3)
All times are GMT -4. The time now is 12:00 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy