Sponsored Content
Top Forums UNIX for Advanced & Expert Users Without the aid of the escape mechanism, how to put a raw string into a variable? Post 303045756 by MadeInGermany on Sunday 12th of April 2020 07:18:20 AM
Old 04-12-2020
An embedded string in a shell script is normally fenced with either ' or " so you need to escape these characters inside the string.
Try a here doc:
Code:
read STRING <<"EOT"
 !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~
EOT

Now the fence is a custom word.
You must quote it to prevent variable substitutions.
BTW if a file or a here doc has got one line then read is smarter than cat.
 

8 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Put raw data to column data

Dear all, I want below data to make it in column format.so i will see the data like this cdrID teleServiceCode chargedPartyNumber ... ... ... ... "egmailcom0w10ggzx00" 'sMS (5)' "716323770" "m17ifi5z30w0z6o7200" 'sMS (5)' ... (7 Replies)
Discussion started by: Nayanajith
7 Replies

2. UNIX for Advanced & Expert Users

Remove escape characters from string

Hello all, I have a string var which contains formatting characters at the end, it is a string with EScape sequences at the end of it. How can I remove them so that I only keep the 'real' text? I tried : var1=${var1%%\033[0m} does not seem to do the job .... Please help Thanks (2 Replies)
Discussion started by: gio001
2 Replies

3. Programming

how to use hex escape char with string in C?

I want it to ouput "abcd", but it dosen't. 1 #include<stdio.h> 2 int main() 3 { 4 printf("a\x62cd"); 5 } 6 gcc alarm.c -o alarm alarm.c: In function 'main': alarm.c:4:9: warning: hex escape sequence out of range It seems that the complier joint "cd" as part of... (8 Replies)
Discussion started by: vistastar
8 Replies

4. Shell Programming and Scripting

awk not escape my bash variable

I tried to parse data from switch configuration files vlan 1727 name SQ5506-15 by port tagged ethe 8/1 to 8/2 untagged ethe 1/13 ! vlan 2105 name SQ5620-7007(BR2) by port tagged ethe 8/1 to 8/2 untagged ethe 1/17 ! interface ethernet 1/13 port-name SQ5506-15.nic0 rate-limit... (2 Replies)
Discussion started by: winggundamth
2 Replies

5. Shell Programming and Scripting

How to store a escape character in a Variable.?

How to store escape character in the variable. Var=abc,def,ghi,jkl echo ${Var} | sed -e "s/,/|\\\\./g;s/^/\\\\./g" \.abc|\.def|\.ghi|\.hjk Var1=`echo ${Var} | sed -e "s/,/|\\\./g;s/^/\\\./g"` Actual: ------- echo $Var1 .abc|.def|.ghi|.jkl Expected: --------- echo $Var1... (4 Replies)
Discussion started by: deepakwins
4 Replies

6. UNIX for Beginners Questions & Answers

String has * as the field delimiter and I need echo/awk to escape it, how?

Hi, I am trying to read an Oracle listener log file line by line and need to separate the lines into several fields. The field delimiter for the line happens to be an asterisk. I have the script below to start with but when running it, the echo command is globbing it to include other... (13 Replies)
Discussion started by: newbie_01
13 Replies

7. Shell Programming and Scripting

How to escape colon sign from variable in shell?

Hello, Below script works fine when I manually enter required information for each file. When it comes to shell in auto mode, it gives various errors. I am under ubuntu 14.04 / trusty. manual_run.sh: #!/bin/bash /usr/bin/ffmpeg -start_at_zero -copyts -i nicki.mp4 -c:v mpeg2video \ -b:v 500k... (3 Replies)
Discussion started by: baris35
3 Replies

8. Shell Programming and Scripting

Escape characters in a variable

Debian 9 64x - LXDE How can i disable escape sequences in a variable? #!/bin/bash #mainscript . "./links.bash" echo "$red_start This text should be red $color_end"#!/bin/bash #links.bash #colors red_start="\eOutput that i get: \e Output expected: This text should be... (5 Replies)
Discussion started by: int3g3r
5 Replies
FENCE_NODE(8)							      cluster							     FENCE_NODE(8)

NAME
fence_node - a utility to run fence agents SYNOPSIS
fence_node [OPTIONS] nodename DESCRIPTION
This utility runs a fence agent against nodename. The agent and args are taken from the running cluster configuration based on clus- ter.conf(5). fence_node is a wrapper around the libfence functions: fence_node() and unfence_node(). These libfence functions use libccs to read the node fencing configuration, which means that corosync (with cman and ccs) must be running to use fence_node(8). The fenced(8) daemon is the main user of libfence:fence_node(), and the configuration details for that function are given in the fenced(8) man page. Fencing vs. Unfencing The main use for unfencing is with storage/SAN (non-power) agents. When using power-based fencing agents, the fencing action itself is supposed to turn a node back on after first turning the power off (this happens automatically with a "reboot" action, and needs to be configured explicitly as "off" + "on" otherwise.) When using storage-based fencing agents, the fencing action is not allowed to re-enable a node after disabling it. Re-enabling a fenced node is only safe once the node has been rebooted. A natural way to re-enable a fenced node's access to storage, is for that node to re- enable the access itself during its startup process. The cman init script calls fence_node -U (nodename defaults to local nodename when unfencing). Unfencing a node without an <unfence> configuration (see below) is a no-op. The basic differences between fencing and unfencing: Fencing 1. libfence: fence_node(), command line: fence_node nodename 2. Turns off or disables a node. 3. Agents run with the default action of "off", "disable" or "reboot". 4. Performed by a cluster node against another node that fails (by the fenced daemon). Unfencing 1. libfence: unfence_node(), command line: fence_node -U nodename 2. Turns on or enables a node. 3. Agents run with the explicit action of "on" or "enable". 4. Performed by a cluster node "against" itself during startup (by the cman init script). OPTIONS
-U Unfence the node, default local node name. -v Show fence agent results, -vv to also show agent args. -h Print a help message describing available options, then exit. -V Print program version information, then exit. FILES
The Unfencing/unfence_node() configuration is very similar to the Fencing/fence_node() configuration shown in fenced(8). Unfencing is only performed for a node with an <unfence> section: <clusternode name="node1" nodeid="1"> <fence> </fence> <unfence> </unfence> </clusternode> The <unfence> section does not contain <method> sections like the <fence> section does. It contains <device> references directly, which mirror the corresponding device sections for <fence>, with the notable addition of the explicit action of "on" or "enable". The same <fencedevice> is referenced by both fence and unfence <device> lines, and the same per-node args should be repeated. <clusternode name="node1" nodeid="1"> <fence> <method name="1"> <device name="myswitch" foo="x"/> </method> </fence> <unfence> <device name="myswitch" foo="x" action="on"/> </unfence> </clusternode> SEE ALSO
fenced(8) cluster 2009-12-21 FENCE_NODE(8)
All times are GMT -4. The time now is 10:22 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy