Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Environment Variable with Special characters Post 302643863 by jim mcnamara on Sunday 20th of May 2012 10:50:34 PM
Old 05-20-2012
This is file matched by the shell at the time you create it.
Code:
FILE_ARG=FILE_NM_?(20120515|20120516)??????_sas.sig

This is not
Code:
FILE_ARG='FILE_NM_?(20120515|20120516)??????_sas.sig'

This last example is then used this way:
Code:
ls -l $FILE_ARG

which expands the variable into a valid filename.
 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Special characters getting replaced by &Pound in Unix Environment

Hi, Please find the Question Summary below- In our email template document(.txt) bullets and Apostrophe are getting replaced by the string "&pound" in our Live environment.We are using sun solaris 8 in live. Can anybody let me know why this happens and how to prevent this . Thanks... (0 Replies)
Discussion started by: kaushik05
0 Replies

2. Shell Programming and Scripting

Variable Manimpulation - special characters

Hello- I have a variables that contains a string like this usr/pass@SCHEMA I want to extract the usr/pass part and ignore the SCHEMA part, I tried to use this ${dbconn%%@} and apparently it will not work because @ is a special character. I tried \@ and still no go. Any idea how to solve... (1 Reply)
Discussion started by: Nomaad
1 Replies

3. Shell Programming and Scripting

Special characters in a bash variable in sed

Hello, I am trying the following: echo __CHANGEME__ >> testfile VAR1="&&&" sed -i "s|__CHANGEME__|${VAR1}|" testfile cat testfile This results in testfile containing __CHANGEME____CHANGEME____CHANGEME__ Whereas I want it to result in &&& I understand that if VAR1="\&\&\&" then... (3 Replies)
Discussion started by: linuxnewbeee
3 Replies

4. UNIX for Dummies Questions & Answers

How to see special characters?

Hi all, I was wondering how can i see the special characters like \t, \n or anything else in a file by using Nano or any other linux command like less, more etc (6 Replies)
Discussion started by: gvj
6 Replies

5. Shell Programming and Scripting

Sed failing for variable with special characters

This has been covered many times earlier but couldnt figure the issue myself. Can you please advise whats wrong on the below code I have a variable with special character ($) and am using that variable to replace another variable in file but however sed is failing to parse it correctly ... (7 Replies)
Discussion started by: sasiharitha
7 Replies

6. Shell Programming and Scripting

special characters

Hey guys, I'm trying to replace "]Facebook" from the text but sed 's/]Facebook/Johan/g' is not working could you please help me with that? (6 Replies)
Discussion started by: Johanni
6 Replies

7. Shell Programming and Scripting

Replace special characters with Escape characters?

i need to replace the any special characters with escape characters like below. test!=123-> test\!\=123 !@#$%^&*()-= to be replaced by \!\@\#\$\%\^\&\*\(\)\-\= (8 Replies)
Discussion started by: laknar
8 Replies

8. Shell Programming and Scripting

Trouble with sed and substituting a string with special characters in variable

Hey guys, I know that title is a mouthful - I'll try to better explain my struggles a little better... What I'm trying to do is: 1. Query a db and output to a file, a list of column data. 2. Then, for each line in this file, repeat these values but wrap them with: ITEM{ ... (3 Replies)
Discussion started by: ampsys
3 Replies

9. Shell Programming and Scripting

Parsing special characters from variable commands

Hi, I am fairly new to unix scripting and recently tasked with some reporting scripts. The reporting checks several batch jobs and this is quite iterative. Now I am trying to minimize script effort and maximize reusability as there are only slight nuances in the repetitive tasks. For... (3 Replies)
Discussion started by: joeniks
3 Replies

10. Shell Programming and Scripting

awk match shell variable that contains special characters?

How to match a shell variable that contains parenthesis (and other special characters like "!") file.txt contains: Charles Dickens Matthew Lewis (writer) name="Matthew Lewis (writer)"; awk -v na="$name" ' $0 ~ na' file.txt Ideally this would match $name in file.txt (in this... (3 Replies)
Discussion started by: Mid Ocean
3 Replies
explain_kill(3) 					     Library Functions Manual						   explain_kill(3)

NAME
explain_kill - explain kill(2) errors SYNOPSIS
#include <libexplain/kill.h> const char *explain_kill(pid_t pid, int sig); const char *explain_errno_kill(int errnum, pid_t pid, int sig); void explain_message_kill(char *message, int message_size, pid_t pid, int sig); void explain_message_errno_kill(char *message, int message_size, int errnum, pid_t pid, int sig); DESCRIPTION
These functions may be used to obtain explanations for errors returned by the kill(2) system call. explain_kill const char *explain_kill(pid_t pid, int sig); The explain_kill function is used to obtain an explanation of an error returned by the kill(2) system call. The least the message will con- tain is the value of strerror(errno), but usually it will do much better, and indicate the underlying cause in more detail. The errno global variable will be used to obtain the error value to be decoded. pid The original pid, exactly as passed to the kill(2) system call. sig The original sig, exactly as passed to the kill(2) system call. Returns: The message explaining the error. This message buffer is shared by all libexplain functions which do not supply a buffer in their argument list. This will be overwritten by the next call to any libexplain function which shares this buffer, including other threads. Note: This function is not thread safe, because it shares a return buffer across all threads, and many other functions in this library. Example: This function is intended to be used in a fashion similar to the following example: if (kill(pid, sig) < 0) { fprintf(stderr, "%s ", explain_kill(pid, sig)); exit(EXIT_FAILURE); } The above code example is available pre-packaged as the explain_kill_or_die(3) function. explain_errno_kill const char *explain_errno_kill(int errnum, pid_t pid, int sig); The explain_errno_kill function is used to obtain an explanation of an error returned by the kill(2) system call. The least the message will contain is the value of strerror(errno), but usually it will do much better, and indicate the underlying cause in more detail. errnum The error value to be decoded, usually obtained from the errno global variable just before this function is called. This is neces- sary if you need to call any code between the system call to be explained and this function, because many libc functions will alter the value of errno. pid The original pid, exactly as passed to the kill(2) system call. sig The original sig, exactly as passed to the kill(2) system call. Returns: The message explaining the error. This message buffer is shared by all libexplain functions which do not supply a buffer in their argument list. This will be overwritten by the next call to any libexplain function which shares this buffer, including other threads. Note: This function is not thread safe, because it shares a return buffer across all threads, and many other functions in this library. Example: This function is intended to be used in a fashion similar to the following example: if (kill(pid, sig) < 0) { int err = errno; fprintf(stderr, "%s ", explain_errno_kill(err, pid, sig)); exit(EXIT_FAILURE); } The above code example is available pre-packaged as the explain_kill_or_die(3) function. explain_message_kill void explain_message_kill(char *message, int message_size, pid_t pid, int sig); The explain_message_kill function is used to obtain an explanation of an error returned by the kill(2) system call. The least the message will contain is the value of strerror(errno), but usually it will do much better, and indicate the underlying cause in more detail. The errno global variable will be used to obtain the error value to be decoded. message The location in which to store the returned message. If a suitable message return buffer is supplied, this function is thread safe. message_size The size in bytes of the location in which to store the returned message. pid The original pid, exactly as passed to the kill(2) system call. sig The original sig, exactly as passed to the kill(2) system call. Example: This function is intended to be used in a fashion similar to the following example: if (kill(pid, sig) < 0) { char message[3000]; explain_message_kill(message, sizeof(message), pid, sig); fprintf(stderr, "%s ", message); exit(EXIT_FAILURE); } The above code example is available pre-packaged as the explain_kill_or_die(3) function. explain_message_errno_kill void explain_message_errno_kill(char *message, int message_size, int errnum, pid_t pid, int sig); The explain_message_errno_kill function is used to obtain an explanation of an error returned by the kill(2) system call. The least the message will contain is the value of strerror(errno), but usually it will do much better, and indicate the underlying cause in more detail. message The location in which to store the returned message. If a suitable message return buffer is supplied, this function is thread safe. message_size The size in bytes of the location in which to store the returned message. errnum The error value to be decoded, usually obtained from the errno global variable just before this function is called. This is neces- sary if you need to call any code between the system call to be explained and this function, because many libc functions will alter the value of errno. pid The original pid, exactly as passed to the kill(2) system call. sig The original sig, exactly as passed to the kill(2) system call. Example: This function is intended to be used in a fashion similar to the following example: if (kill(pid, sig) < 0) { int err = errno; char message[3000]; explain_message_errno_kill(message, sizeof(message), err, pid, sig); fprintf(stderr, "%s ", message); exit(EXIT_FAILURE); } The above code example is available pre-packaged as the explain_kill_or_die(3) function. SEE ALSO
kill(2) send signal to a process explain_kill_or_die(3) send signal to a process and report errors COPYRIGHT
libexplain version 0.52 Copyright (C) 2009 Peter Miller explain_kill(3)
All times are GMT -4. The time now is 11:32 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy