Sponsored Content
Top Forums Shell Programming and Scripting Declaring variables without initialization Post 302629045 by asterisk-ix_use on Tuesday 24th of April 2012 09:02:59 AM
Old 04-24-2012
No need to declare variables in a shell script. The variables come to existence automatically when they are used. All the variables that do not exist are assumed to be null. So if you wish to give all the variables you wannt to use in your script to some default value, initialize them using
PHP Code:
variable=value 
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Declaring variable environments in .cshrc

Hi All, I have been trying to set variable environment for the JAVA_HOME but it doesn' work. The path set is as follows setenv JAVA_HOME "/usr/local/jdk1.3" setenv PATH $JAVA_HOME/bin setenv CLASSPATH ${JAVA_HOME}/lib/tools.jar:{JAVA_HOME}/lib/dt.jar can anyone suggest Me where am I and... (2 Replies)
Discussion started by: v_sharda
2 Replies

2. Shell Programming and Scripting

Declaring Local Arrays

I have some function function() { fileNamelist=( `find Uploads -name "somePattern" | tr '\n' ' '` ) } but "local fileNamelist" makes it variable. How do I declare fileNameList as a local array in BASH? (1 Reply)
Discussion started by: ksh
1 Replies

3. Shell Programming and Scripting

Declaring functions in CSH

Hi all, It might seem like a very trivial question but I am new to shell scripting so excuse for that. I have an existing script in CSH. I need to create a function in the script which takes some parameters and returns a result. Can someone please let me know the syntax for function... (4 Replies)
Discussion started by: tipsy
4 Replies

4. BSD

Declaring Global Variables in KLD

Hello, how can I define a global variables in KLD? I would like to define some variables in my KLD and then would like to use them from other KLD. Thanx (1 Reply)
Discussion started by: int80h
1 Replies

5. Shell Programming and Scripting

declaring variable with for $(seq)

Hi guys. i have the following script: 1 #!/bin/bash 2 linkcount=$(grep "/portal" tickets | wc -l) 3 grep "/portal" tickets > links 4 for i in $(seq 1 $linkcount); do 5 echo "BLYAT" 6 let link$i=$(sed -n "$i"p links) 7 echo $ 8 done the problem is, that "let" can`t... (1 Reply)
Discussion started by: neverhood
1 Replies

6. UNIX for Advanced & Expert Users

Declaring LD_PRELOAD system wide for dynamic loading

Dear Fellows; As being new to linux, i have tried to synamically load a custom library which overrides some system calls like conncet(), socket() etc.... for custom purposes. It works well, if declaring the environment path LD_PRELOAD and execution of the application to be override... (0 Replies)
Discussion started by: mzeeshan
0 Replies

7. Programming

Declaring variables

Hey guys im facing a problem in declaring variables. i have a few classes like the one below... #ifndef _FINANCE_H #define _FINANCE_H #include <string> #include <iostream> #include <fstream> #include <stdlib.h> using namespace std ; class readStraitsTimesIndex { ... (3 Replies)
Discussion started by: gregarion
3 Replies

8. Shell Programming and Scripting

declaring a variabale as string type

I know that directly we can assign a string to a variable but is there any other way to declare a variable as string type. I am using tcsh shell where I am using a function which would return a value of string type but when I am using return keyword , it is returning only integer value.pls help. (3 Replies)
Discussion started by: maitree
3 Replies

9. UNIX for Dummies Questions & Answers

PERL: Declaring Array

Is it possible to declare an array in the following way: @tmp = (@f,"String1","String2", "String3",@f); I'm getting the following error message: Array found where operator expected at Program.pl line 181, near "" (Missing semicolon on previous line?) ---------- Post updated at... (1 Reply)
Discussion started by: WongSifu
1 Replies

10. Shell Programming and Scripting

Declaring arrays in csh

Does anyone know how to declare an array in csh? I don't want to declare any elements in the array because I have a variable that represents the size of the array. For example: the array I want to declare is called sortList and it passes in the variable ARRAYSIZE that stores the value 8. (1 Reply)
Discussion started by: demet8
1 Replies
IMPORT_REQUEST_VARIABLES(3)						 1					       IMPORT_REQUEST_VARIABLES(3)

import_request_variables - Import GET/POST/Cookie variables into the global scope

SYNOPSIS
bool import_request_variables (string $types, [string $prefix]) DESCRIPTION
Imports GET/POST/Cookie variables into the global scope. It is useful if you disabled register_globals, but would like to see some vari- ables in the global scope. If you're interested in importing other variables into the global scope, such as $_SERVER, consider using extract(3). Warning This function has been DEPRECATED as of PHP 5.3.0 and REMOVED as of PHP 5.4.0. PARAMETERS
o $types - Using the $types parameter, you can specify which request variables to import. You can use 'G', 'P' and 'C' characters respec- tively for GET, POST and Cookie. These characters are not case sensitive, so you can also use any combination of 'g', 'p' and 'c'. POST includes the POST uploaded file information. Note Note that the order of the letters matters, as when using " GP", the POST variables will overwrite GET variables with the same name. Any other letters than GPC are discarded. o $prefix - Variable name prefix, prepended before all variable's name imported into the global scope. So if you have a GET value named " userid", and provide a prefix " pref_", then you'll get a global variable named $pref_userid. Note Although the $prefix parameter is optional, you will get an E_NOTICE level error if you specify no prefix, or specify an empty string as a prefix. This is a possible security hazard. Notice level errors are not displayed using the default error reporting level. RETURN VALUES
Returns TRUE on success or FALSE on failure. EXAMPLES
Example #1 import_request_variables(3) example <?php // This will import GET and POST vars // with an "rvar_" prefix import_request_variables("gp", "rvar_"); echo $rvar_foo; ?> SEE ALSO
$_REQUEST, register_globals, Predefined Variables, extract(3). PHP Documentation Group IMPORT_REQUEST_VARIABLES(3)
All times are GMT -4. The time now is 02:17 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy