Is there for the bash something like perls __DATA__?
I mean the feature, that the code after __DATA__ will not be executed.
Is there for the bash something like perls __DATA__ ? I mean the feature,
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Shell scripts are parsed on a line-by-line basis as they execute, so you just need to ensure execution never reaches the data you want to protect. You could do this, for instance:
To actually read this data from your script, you can use some sed magic to extract everything after the first line containing only
__DATA__, then store the output of that sed in a variable. Here’s an example:If you save this script as
test-data.shand make it executable, you can run it and get the following output: