function::kernel_or_user_string_quoted - Linux
Overview
function::kernel_or_user_string_quoted
(function)
The function::kernel_or_user_string_quoted
function returns a quoted string containing either the kernel string or user string, with the string’s escaping and quoting style adapted to match the other string.
This function works well for kernel headers that use C++ string literals, such as with CONFIG_PF_RING_BUILD_TIME_OPTIONS
, #define
, or similar.
Syntax
function::kernel_or_user_string_quoted($kernel_string, $user_string)
| Argument | Description |
|—|—|
| $kernel_string
| The kernel string, usually obtained from a kconfig symbol or similar. |
| $user_string
| The user string. |
Options/Flags
None.
Examples
$ kernel_string = "CONFIG_PF_RING_BUILD_TIME_OPTIONS=\"-DUnix_hardlink_support=\"false\"\"";
$ user_string = "-DUnix_hardlink_support=true";
$user_string = function::kernel_or_user_string_quoted($kernel_string, $user_string);
// $user_string = "-DUnix_hardlink_support=false"
Common Issues
None.
Integration
This function can be used with other Linux commands and tools to process and manipulate kernel strings. For example, it can be used with the sed
command to replace kernel strings in a file.
Related Commands
function::kernel_or_user_string
function::kernel_remove_domain
function::kernel_remove_suffix
function::kernel_remove_prefix