Hi All,
I am new to bash scripting. I need your help to removing spaces from a string and assign them to different variables.
Iwant to call script with one command line argument which is file name which containes different attributes their type and different values eg
... (1 Reply)
How...
can I read input by a user character by cahracter. And assign each character from the string to a variable?
Any help would be greatly appreciated!
Thank you! (1 Reply)
Hi
I am trying to write a function that needs to be able to assign the last run shell command to a variable. The actual command string itself not the exit code of the command.
I am using the bash command recall ability to do this as follows:
alias pb='ps | grep ash' ... (3 Replies)
greetings all,
I am have a heck of a time trying to accomplish a very simple thing. I have an array of "shortname<spaces>id" created from a dscl output. I want to assign shortname=word1 and id=word2. I have tried
shortname=$(${textArray} | awk '{print $1}') - and get 'awk : cannot open... (3 Replies)
I'm running a bash script query and assigning the output to a variable like this:
exists=`mysql -u $USER_NAME --password=$PASSWORD -D "somedb" \
-e "SELECT * FROM somedb.sometable WHERE field1 ='$a' \
AND field2 ='$b' LIMIT 0 , 30";`
which returns something like:
echo... (2 Replies)
Hello Experts,
In my script i am using the below syntax
/usr/bin/head -1 /opt/chumma.txt | /usr/bin/cut -d " " -f3
output of this one is --> Monday
I want to store this String in a variable (i.e) j or k...
Give me some idea experts.
Thanks in advance. (7 Replies)
I see a millioin ways to do this with echo, but what I wan to do is assign a variable the "nth" character of an incoming parameter to a ksh script.
$1 will be "pia"
I need to assign the first character to stmttype. (10 Replies)
Hi guys,
New to the forum, and been messing around with Linux for about a year now. I'm still very much a rookie, so just assume that I'm a total idiot:
I currently have a shell that spits out a CSV number string of about 8 numbers as follows:
1.00,2.00,3.00 ... ,8.00I need to assign a... (7 Replies)
In the else of the main if condition .
else
set lnk = $(readlink -f <path> | cut -d '/' -f7)
echo "$lnk"
if ]
When I run the above on command line , the execution seems to be fine and I get the desired output. But when I try to assign it to a variable within a loop... (12 Replies)
Hi,
I am attempting to assign the output of the following command, to two bash variables, var1 and var2 using "read," but it doesn't seem to be working.
# openstack hypervisor stats show | awk -F'|' 'NR==14{print $2,$3}'
vcpus 92
# echo $?
0
# openstack hypervisor... (4 Replies)
Discussion started by: sand1234
4 Replies
LEARN ABOUT SUNOS
echo
echo(1B) SunOS/BSD Compatibility Package Commands echo(1B)NAME
echo - echo arguments to standard output
SYNOPSIS
/usr/ucb/echo [-n] [argument]
DESCRIPTION
echo writes its arguments, separated by BLANKs and terminated by a NEWLINE, to the standard output.
echo is useful for producing diagnostics in command files and for sending known data into a pipe, and for displaying the contents of envi-
ronment variables.
For example, you can use echo to determine how many subdirectories below the root directory (/) is your current directory, as follows:
o echo your current-working-directory's full pathname
o pipe the output through tr to translate the path's embedded slash-characters into space-characters
o pipe that output through wc -w for a count of the names in your path.
example% /usr/bin/echo "echo $PWD | tr '/' ' ' | wc -w"
See tr(1) and wc(1) for their functionality.
The shells csh(1), ksh(1), and sh(1), each have an echo built-in command, which, by default, will have precedence, and will be invoked if
the user calls echo without a full pathname. /usr/ucb/echo and csh's echo() have an -n option, but do not understand back-slashed escape
characters. sh's echo(), ksh's echo(), and /usr/bin/echo, on the other hand, understand the black-slashed escape characters, and ksh's
echo() also understands a as the audible bell character; however, these commands do not have an -n option.
OPTIONS -n Do not add the NEWLINE to the output.
ATTRIBUTES
See attributes(5) for descriptions of the following attributes:
+-----------------------------+-----------------------------+
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
+-----------------------------+-----------------------------+
|Availability |SUNWscpu |
+-----------------------------+-----------------------------+
SEE ALSO csh(1), echo(1), ksh(1), sh(1), tr(1), wc(1), attributes(5)NOTES
The -n option is a transition aid for BSD applications, and may not be supported in future releases.
SunOS 5.10 3 Aug 1994 echo(1B)