This question already has answers here:
How do you do block comments in YAML?
(11 answers)
Closed 6 years ago.
I know that you can make a single line comment in YAML by using the # tag, but I haven't been able to find something like /* in java that starts a comment & has to be finished off with a */. Does such an operator exist in YAML?
YAML does not support multiple line comments. If you want to use them. You can just try
# this
# is a multiple
# line comment
Related
This question already has answers here:
How to match nothing if a file name glob has no matches [duplicate]
(2 answers)
How to skip the for loop when there are no matching files?
(2 answers)
Closed 3 days ago.
I have some output files like output1.bin, output2.bin and I need to add them to the list output_files. It works as expected when output files exists, but it adds "output*.bin" in the list variable if output1.bin, output2.bin does not exists. I expected that if "${outputdir}"/output*.bin doesn't match any file it should not even iterate through it i.e. I expeted the list to be empty but it adds output*bin name to it. Can someone explain the behavior and the fix ?
for bin_file in "${outputdir}"/output*.bin; do
output_files+=("${bin_file}")
done
This question already has answers here:
How to append output to the end of a text file
(13 answers)
Closed 8 months ago.
I have an existing config config.ini file with the following content:
VALUE_A=a
VALUE_B=b
Using Bash, I'd like to add a new key-value pair VALUE_C=c to get the following:
VALUE_A=a
VALUE_B=b
VALUE_C=c
Is there a concise way to do this with Bash (ideally a one liner)?
As suggested in the comments, the answer is simply:
echo VALUE_C=c >> config.ini
This question already has an answer here:
Escaping the # character in .env file
(1 answer)
Closed 2 years ago.
I'm having troubles using special chars in values of a Laravel .env file.
For example:
DB_PASSWORD=some#secret
Now the env('DB_PASSWORD') is just 'some'
Is there a way to escape characters or some other method to use values like this in the .env file?
In case it makes a difference, my server is running on CentOS 8.2.2004
UPDATE: Forget the whole thing. It turned out it was a different issue altogether. Answer below is correct on the actual question though.
# is for commenting in a .env file. If you want to use # as a value, you need to wrap it in ":
DB_PASSWORD='some#secret'
This question already has answers here:
What is file globbing?
(1 answer)
Stop shell wildcard character expansion?
(4 answers)
command line * linux [duplicate]
(1 answer)
Closed 4 years ago.
I stumbled upon this while working through the exercises in K&R2. Why does echo * prints the names of all files in the current directory? More generally, when I write a C program that takes command-line arguments, and when I give it * as an argument, it puts the names of all files in its parent directory in to the argument vector. Why does this happen? What is so special about *?
I could not find anything about this in the internet.
This is called globbing. Here's a detailed description. Other wildcards include ? for one character, [abc] for one of a set of characters, and [a-z] for one of a range of characters. This is built into various shells, including Bash.
In response to your comment "I think echo is written in C" — this doesn't matter a bit. Once source code is compiled into an executable containing machine code, it doesn't matter what language it was written in.
This question already has an answer here:
What is the Ruby equivalent of preg_quote()?
(1 answer)
Closed 7 years ago.
Lets say I want to match against CVS comments like:
// $Source$
My regex currently looks like this:
if ( /^\/\/\s*\$Source\$/ =~ line)
Which works, but I'm left wondering -- is there a prettier way to write this?
Use the %r syntax:
if ( %r{//\s*\$Source\$} =~ line)
^^ I'm not sure whether ruby would allow unescaped `$` here or not