Sponsored Content
Top Forums Shell Programming and Scripting if loop not working in BASH shell Post 302256319 by Franklin52 on Sunday 9th of November 2008 10:32:11 AM
Old 11-09-2008
You are assigning the values as a common string to the variables, try this:

Code:
array=(1 2 3 4 5)
array2=(5 6 7 8 9)

instead of:

Code:
array="1 2 3 4 5"
array2="5 6 7 8 9"

 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

korn shell to bash - statement not working

Everything else seems to be working, but this isn't. Is it the "cat..." that is wrong of the condition? Thanks. cat tc_result.txt | while read LINE do if then let "files_run += 1"; echo "inside the if loop" # save current filetype case $LINE... (5 Replies)
Discussion started by: brdholman
5 Replies

2. UNIX for Dummies Questions & Answers

Anyone know?: How the 'for'-loop could stop working in interactive bash shell?!

It is happening with my sessions already second time: a 'for'-loop for some reason stop to work as expected. That means or it is looping without exitting, or it is not loop even once. Here example of my try when it is not processing even one loop. You can see, I start new subshell and... (14 Replies)
Discussion started by: alex_5161
14 Replies

3. Shell Programming and Scripting

Shell Script not working using for loop and a funtion

Hi- Here is the shell script that for some reason is not returning results: #! /bin/ksh - avg() { AVG=0 typeset SUM=0 if then echo "You must have at least two numbers" else for NUM in "$*" do ... (2 Replies)
Discussion started by: koomba
2 Replies

4. Shell Programming and Scripting

export not working in Bash shell

Hi Friends, I am presently migrating shell scripts writter in KSH to SH.I am stuck at this place and i am not able to find a work around:- Let the script name is x.sh Below are some of the codes in it... export abc=hello export abc=hi export abc=how When i am trying to compile the script ... (6 Replies)
Discussion started by: amit.behera
6 Replies

5. Shell Programming and Scripting

BASH: Factorial using FOR loop not working

Hi, I am trying to run the factorial script but it’s not working. The code is mentioned below: ------------------------------------------------------------------ /home/gc> cat fact.sh #!/bin/bash # using one command line parameter factorial=1 for (( number = 1; number <= $1 ;... (3 Replies)
Discussion started by: Technext
3 Replies

6. UNIX for Dummies Questions & Answers

For loop in bash shell

Hi, I am using a for loop to manipulate files data_1.txt through data_100.txt. The for-loop is set up like this: for i in {1..100}; do cut -f1 data_$i.txt > output$i.txt I get the following error message when I run the code: cannot open `data.txt' for reading: No such file or directory... (4 Replies)
Discussion started by: evelibertine
4 Replies

7. Shell Programming and Scripting

Shell script loop not working

Hi I'm using this script to transcode videos in an Ubuntu 12.04 machine. #! /bin/bash MOVDIR="/media/topaz_1/media/transcodes/transcode_mov/" MOVDESTDIR="/media/topaz_1/media/transcodes/final_mov/" DONEFILESDIR="/media/topaz_1/media/transcodes/dv_cache/"... (1 Reply)
Discussion started by: oscarfelson
1 Replies

8. Shell Programming and Scripting

Bash Shell loop - Help !

Dear all Linux lover, I am a new learner to Bash Shell script and I would like to writing a script to to repeat my script. This mean I would like to have multiple same of result after running the .sh. ####### TIMES_NO=0 echo -n "Please enter the number for times to repeat ?" read... (10 Replies)
Discussion started by: Rocky888
10 Replies

9. Shell Programming and Scripting

Aliases NOT working inside bash shell script

i have defined a function ln_s() for customizing the ln command in script1.sh. more script1.sh echo "Starting Execution" ./script2.sh echo "End of Execution" ln_s(){ ] && return ln -s "$1" "$2" } My script1.sh executes another script2.sh which has the following entry more script2.sh... (12 Replies)
Discussion started by: mohtashims
12 Replies

10. Shell Programming and Scripting

For loop in bourne shell is not working

I have a loop with cases I am working on Bourne shell for file in *.${Today}*.csv *.${Today}*.txt\ do case ${file} in sun_detail) do something ;; sum) do something ;; mod) do something ;; *) do something ;; (5 Replies)
Discussion started by: digioleg54
5 Replies
WINCACHE_UCACHE_DELETE(3)						 1						 WINCACHE_UCACHE_DELETE(3)

wincache_ucache_delete - Deletes variables from the user cache

SYNOPSIS
bool wincache_ucache_delete (mixed $key) DESCRIPTION
Deletes the elements in the user cache pointed by $key. PARAMETERS
o $key - The $key that was used to store the variable in the cache. $key is case sensitive. $key can be an array of keys. RETURN VALUES
Returns TRUE on success or FALSE on failure. If $key is an array then the function returns FALSE if every element of the array fails to get deleted from the user cache, otherwise returns an array which consists of all the keys that are deleted. EXAMPLES
Example #1 Using wincache_ucache_delete(3) with $key as a string <?php wincache_ucache_set('foo', 'bar'); var_dump(wincache_ucache_delete('foo')); var_dump(wincache_ucache_exists('foo')); ?> The above example will output: bool(true) bool(false) Example #2 Usingwincache_ucache_delete(3) with $key as an array <?php $array1 = array('green' => '5', 'blue' => '6', 'yellow' => '7', 'cyan' => '8'); wincache_ucache_set($array1); $array2 = array('green', 'blue', 'yellow', 'cyan'); var_dump(wincache_ucache_delete($array2)); ?> The above example will output: array(4) { [0]=> string(5) "green" [1]=> string(4) "Blue" [2]=> string(6) "yellow" [3]=> string(4) "cyan" } Example #3 Using wincache_ucache_delete(3) with $key as an array where some elements cannot be deleted <?php $array1 = array('green' => '5', 'blue' => '6', 'yellow' => '7', 'cyan' => '8'); wincache_ucache_set($array1); $array2 = array('orange', 'red', 'yellow', 'cyan'); var_dump(wincache_ucache_delete($array2)); ?> The above example will output: array(2) { [0]=> string(6) "yellow" [1]=> string(4) "cyan" } SEE ALSO
wincache_ucache_set(3), wincache_ucache_add(3), wincache_ucache_get(3), wincache_ucache_clear(3), wincache_ucache_exists(3), win- cache_ucache_meminfo(3), wincache_ucache_info(3). PHP Documentation Group WINCACHE_UCACHE_DELETE(3)
All times are GMT -4. The time now is 02:19 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy