Sponsored Content
Top Forums Shell Programming and Scripting [Solved] reassign value to variable Post 302693467 by RudiC on Wednesday 29th of August 2012 09:09:47 AM
Old 08-29-2012
You don't mention which shell you are using. Assuming it's bash, the assignment seems correct, but the preceding if construct will not work. Replace the "eq" (should be -eq anyhow), which compares integers, with "==", which compares strings.
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Reassign value to a string variable

hi to all, i have a string variable that i want to reassign a new value in it through a script and i am having some trouble. i write the following if statement: if then $checkupd="lastupdate = " fi in this statement i check if the variable checkupd contains the word "lastupdate".... (2 Replies)
Discussion started by: omonoiatis9
2 Replies

2. Shell Programming and Scripting

Manipulating a variable using sed (solved)

Hi, My variable has value as this: tvar1="bool_risk_enabled" Boolean "true" Now I need to replace this true with false. Which is the best way to do this? Can we do this with sed command? Please help me. ---------- Post updated at 05:23 PM ---------- Previous update was at 05:00 PM... (2 Replies)
Discussion started by: pravintse
2 Replies

3. UNIX for Dummies Questions & Answers

[Solved] Variable Name as a Prompt

Dear Members, I have an variable by name dir.If i do echo $dir i will get the path (/usr/bin/). I am writing a shell script which will prompt to enter the variable name if run.Suppose the script name is test.sh. If run test.sh it will prompt for entering variable name which is dir.Suppose... (9 Replies)
Discussion started by: sandeep_1105
9 Replies

4. UNIX for Dummies Questions & Answers

Solved: how to save an output to a variable

i want to save the output of /scripts/whoowns domain.com to a username like $user = /scripts/whoowns domain.com but I'm not sure how to do that This is inside a bash script how can I get the output of /scripts/whoowns then save that to a variable? thanks! ---------- Post updated at... (0 Replies)
Discussion started by: vanessafan99
0 Replies

5. Shell Programming and Scripting

storing a value from another file as a variable[solved]

Hi all, im having snags creating a variable which uses commands like cut and grep. In the instance below im simply trying to take a value from another file and assign it to a variable. When i do this it only prints the $a rather than the actual value. I know its simple but does anyone have any... (1 Reply)
Discussion started by: somersetdan
1 Replies

6. Solaris

reassign zfs pool lun

I have a branded zone txdjintra that utilizes a pool named Pool_djintra that is no longer required. There is a 150 Gig Lun assigned to the pool that I need to reassign to another branded zone txpsrsrv07 with a pool named Pool_txpsrsrv07 on the same sun blade. What is the process to do this? ... (0 Replies)
Discussion started by: jeffsr
0 Replies

7. Shell Programming and Scripting

[Solved] cp command with dollar variable in ksh

hi, I have been trying to acheive the following task for a while now, but failed.. Need help, experts please help! This is what I am trying to do: - I am writing to a flat file the name of the source to be copied and the destination path as to where it is to be copied to. Sample flat file:... (7 Replies)
Discussion started by: abdulhusein
7 Replies

8. Shell Programming and Scripting

[Solved] How to increment and add variable length numbers to a variable in a loop?

Hi All, I have a file which has hundred of records with fixed number of fields. In each record there is set of 8 characters which represent the duration of that activity. I want to sum up the duration present in all the records for a report. The problem is the duration changes per record so I... (5 Replies)
Discussion started by: danish0909
5 Replies

9. Shell Programming and Scripting

[Solved] Count characters of variable from right

My variable is something like: f="/Volumes/VERVE/MOOTON_CALL/01_shots/XX/xx0195/Projects/program/rs0195_v400001.aep" I use ${f:63:6} to call "rs0195" as characters counted from the left, but it'd be so much easier to count from the right. If ${f:95:10} counts from the left, what would... (2 Replies)
Discussion started by: scribling
2 Replies

10. Shell Programming and Scripting

[Solved] Assigning Shell variable

Hello, Need a small help to execute below script. #!/bin/bash . new.txt for no in 3 4 do echo $((uname_$no)) done new.txt contains uname_1="XXXXXX" uname_2="YYYYY" uname_3="ZZZZZ" ......... (6 Replies)
Discussion started by: prasanna2166
6 Replies
strcasecmp(3)						     Library Functions Manual						     strcasecmp(3)

NAME
strcasecmp, strncasecmp - Perform case-insensitive string comparisons LIBRARY
Standard C Library (libc.so, libc.a) SYNOPSIS
#include <strings.h> int strcasecmp( const char *s1, const char *s2 int strncasecmp( const char *s1, const char *s2 size_t n; STANDARDS
Interfaces documented on this reference page conform to industry standards as follows: strcasecmp(), strncasecmp(): XPG4-UNIX Refer to the standards(5) reference page for more information about industry standards and associated tags. PARAMETERS
Points to a location containing first string. Points to a location containing the second of two strings referenced. Specifies the maximum number of bytes to compare. DESCRIPTION
The strcasecmp() function compares the string pointed to by the s1 parameter to the string pointed to by the s2 parameter, while ignoring differences in case. The strncasecmp() function is similar to the strcasecmp function, but also compares size. If the size specified by n is reached before a null, the comparison stops. Note that these functions work for 7-bit ASCII compares only and should not be used in internationalized applications. RETURN VALUES
Upon completion, the strcasecmp() function returns an integer whose value is greater than, equal to, or less than 0 (zero), according to whether the s1 string, ignoring case, is greater than, equal to, or less than the s2 string. Upon successful completion, the strncasecmp() function returns an integer whose value is greater than, equal to, or less than 0 (zero), according to whether the s1 array (possibly null-terminated), ignoring case, is greater than, equal to, or less than the s2 string (possi- bly null-terminated). RELATED INFORMATION
Functions: string(3), strcat(3), strcmp(3), strcpy(3) Standards: standards(5) delim off strcasecmp(3)
All times are GMT -4. The time now is 10:30 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy