How do I write a bash noscript to escape html inside a json string?
- I am trying to upload templates to Amazon SES to send html emails
- As per their documentation here they want you to upload a json file that contains html text inside a string
I wrote a cli command like this
My main problem is with the json file itself
Given an input html file and a text file, I want to generate that json on the fly and send it aws cli
Super appreciate if someone can give me directions on this. I don't even know if my approach is correct
https://redd.it/15lcr07
@r_bash
- I am trying to upload templates to Amazon SES to send html emails
- As per their documentation here they want you to upload a json file that contains html text inside a string
I wrote a cli command like this
aws ses create-template --cli-input-json file://./wiki/email-templates/ses/confirm-email.json
My main problem is with the json file itself
Given an input html file and a text file, I want to generate that json on the fly and send it aws cli
{
"Template": {
"TemplateName": "MyTemplate",
"SubjectPart": "Greetings, {{name}}!",
"HtmlPart": "WHAT TO WRITE IN BASH HERE??? to take HTML file and generate a string out of it that is valid as per JSON rules",
"TextPart": "text file to string HERE...."
}
}
Super appreciate if someone can give me directions on this. I don't even know if my approach is correct
https://redd.it/15lcr07
@r_bash
Amazon
Using templates to send personalized email with the Amazon SES API - Amazon Simple Email Service
Use the Amazon SES CreateTemplate and SendBulkEmail operations to send personalized messages.
How to move #n from the end of files name to the beginning?
I used linux before, so I know that this could be done with bash command probably.
I have a folder on my phone that has a 40 mp4 files with different names but each on of them ends with #n (#1,#2...etc)
I want to put this #n at the beginning of each file name so I can add them to a playlist on vlc as vlc doesn't support sorting by date
I will do this using termux.
And thanks in advance.
https://redd.it/15lgr8f
@r_bash
I used linux before, so I know that this could be done with bash command probably.
I have a folder on my phone that has a 40 mp4 files with different names but each on of them ends with #n (#1,#2...etc)
I want to put this #n at the beginning of each file name so I can add them to a playlist on vlc as vlc doesn't support sorting by date
I will do this using termux.
And thanks in advance.
https://redd.it/15lgr8f
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
Why $(( 015 )) calculate as octal?
https://redd.it/15lm0ev
@r_bash
echo $(( 015 )) yeilds 13. Why and how to change this behavior?https://redd.it/15lm0ev
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
Would like help understanding this, especially the last underscore: xargs -L 1 bash -c 'echo "$1
Hi all
So I was googling and found the following ([SOURCE-NOT-NEEDED-TO-UNDERSTAND-THE\QUESTION](https://stackoverflow.com/questions/12055198/find-out-a-git-branch-creator)):
git branch -a | xargs -L 1 bash -c 'echo "$1
It indeed works (assuming you have git, sorry I don't have a non-git example) and it can be simplified to e.g.
echo main | xargs -L 1 bash -c 'echo "$1 `git log --pretty=format:"%H %an" $1^..$1`"'
What I noticed is that if I omit the last underscore "_", it won't work. I however understand xargs which will run
Thanks!
https://redd.it/15lvnet
@r_bash
git log --pretty=format:"%H %an" $1^..$1"' Hi all
So I was googling and found the following ([SOURCE-NOT-NEEDED-TO-UNDERSTAND-THE\QUESTION](https://stackoverflow.com/questions/12055198/find-out-a-git-branch-creator)):
git branch -a | xargs -L 1 bash -c 'echo "$1
git log --pretty=format:"%H %an" $1^..$1"' It indeed works (assuming you have git, sorry I don't have a non-git example) and it can be simplified to e.g.
echo main | xargs -L 1 bash -c 'echo "$1 `git log --pretty=format:"%H %an" $1^..$1`"'
What I noticed is that if I omit the last underscore "_", it won't work. I however understand xargs which will run
bash -c on the stuff that has been piped through (e.g. git branch -a or echo main)... After that things becomes more complicated with $0 and $1... I've tried to google for understanding this syntax, but I've come to the conclusion that I don't fully understand why this command works and would like to hear if any of you can explain it, especially why the last underscore is needed...Thanks!
https://redd.it/15lvnet
@r_bash
Stack Overflow
Find out a Git branch creator
I want to find out who created a branch.
I am sort of able to do so with:
git branch -a | xargs -L 1 bash -c 'echo "$1 `git log --pretty=format:"%H %an" $1^..$1`"' _
However, this returns the last
I am sort of able to do so with:
git branch -a | xargs -L 1 bash -c 'echo "$1 `git log --pretty=format:"%H %an" $1^..$1`"' _
However, this returns the last
if else statement syntax error
I am very new to bash so the problem may be simple but my code keeps returning an error every time I run it and I've tried changing a few things but it doesn't work.
​
https://preview.redd.it/048izhufa3hb1.png?width=797&format=png&auto=webp&s=93a2b837ef7d9c93b98f82570e90763543dd7f40
​
https://redd.it/15mfu83
@r_bash
I am very new to bash so the problem may be simple but my code keeps returning an error every time I run it and I've tried changing a few things but it doesn't work.
​
https://preview.redd.it/048izhufa3hb1.png?width=797&format=png&auto=webp&s=93a2b837ef7d9c93b98f82570e90763543dd7f40
​
https://redd.it/15mfu83
@r_bash
Issues whith appending string to a variable
Edit: Solved. See below
I have a variable set by the following command:
This works correctly and gives me the output I want when I print with echo. The output is a long line that is wrapped over several lines on the screen. This becomes important later.
The issue arise when I want to append a small string to the variable
I have tried many different versions but all of them end with the same issue, where the added string is printed at the start of the last wrapping line on the display. If I resize the terminal window and run the command again, the string is again printed at the start of the last line, which is now in a different location due to the text being wrapped differently in the resized window.
I've tried running this both in bash and zsh using gnome terminal and terminator. Same result every time.
Does anyone have a clue as to what might be the cause of the issue?
EDIT: Solved by running dos2unix on the source file. The line endings were messing this up.
https://redd.it/15mgrcy
@r_bash
Edit: Solved. See below
I have a variable set by the following command:
column_names=$(head -n 1 "$filename") # | sed 's/\t/ /g')This works correctly and gives me the output I want when I print with echo. The output is a long line that is wrapped over several lines on the screen. This becomes important later.
The issue arise when I want to append a small string to the variable
" varchar(255)"I have tried many different versions but all of them end with the same issue, where the added string is printed at the start of the last wrapping line on the display. If I resize the terminal window and run the command again, the string is again printed at the start of the last line, which is now in a different location due to the text being wrapped differently in the resized window.
I've tried running this both in bash and zsh using gnome terminal and terminator. Same result every time.
Does anyone have a clue as to what might be the cause of the issue?
EDIT: Solved by running dos2unix on the source file. The line endings were messing this up.
https://redd.it/15mgrcy
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
Copied large directory, want to verify, struggling with md5sum
I copied a large directory with multiple layers of folders and subfolders to a new drive and I'd like to verify that everything got copied correctly before I delete it off the old drive.
I'm trying to do this via md5sum (but open to suggestions this is just one that was mentioned a lot) but struggling. I'm not sure if it's the command that just does nothing or if it takes long because it's lots of files, but either the resulting txt file (that's meant to have the checksum) is empty or in a random order.
E.g. this command:
I've also tried this command
Any advice?
Thanks!
https://redd.it/15ml345
@r_bash
I copied a large directory with multiple layers of folders and subfolders to a new drive and I'd like to verify that everything got copied correctly before I delete it off the old drive.
I'm trying to do this via md5sum (but open to suggestions this is just one that was mentioned a lot) but struggling. I'm not sure if it's the command that just does nothing or if it takes long because it's lots of files, but either the resulting txt file (that's meant to have the checksum) is empty or in a random order.
E.g. this command:
find -type f -exec md5sum '{}' \; > md5sum.txt from here actually results in that file being created, but the checksums are then in a seemingly random order. And because of this I'm not sure if the comparison will work if it the checksums from the other drive are in a different order?I've also tried this command
find . -type f -exec md5sum {} + | LC_ALL=C sort | md5sum from here but that one just takes forever or does nothing. And because this one doesn't create a file but is meant to output a collective checksum in terminal, I don't get any feedback if anything's happening.Any advice?
Thanks!
https://redd.it/15ml345
@r_bash
Ask Ubuntu
How can I recursively list Md5sum of all the files in a directory and its subdirectories?
I want to list (and save) Md5 check sum of all the files in a directory and save that list in a text file called md5sum.txt
it would be also nice if I could
Integrate it within tree command (which
it would be also nice if I could
Integrate it within tree command (which
Real-time log streaming. Is it possible?
Can I stream the log content to a mounted partition or a remote directory?
And I have a particular environment and some applications created by the company's development team that are also very specific.
Therefore, occasionally, some problems occur due to very large logs generated in a few hours.
My idea is to stream these logs in real-time (so I can monitor them) and rotate logs daily.
Any idea how to do it with Shell Script?
https://redd.it/15mp2do
@r_bash
Can I stream the log content to a mounted partition or a remote directory?
And I have a particular environment and some applications created by the company's development team that are also very specific.
Therefore, occasionally, some problems occur due to very large logs generated in a few hours.
My idea is to stream these logs in real-time (so I can monitor them) and rotate logs daily.
Any idea how to do it with Shell Script?
https://redd.it/15mp2do
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
grep 5 numbers only?
how do i test for 5 digits only ie i tried
grep -rE "[0-9\]{5}"
​
https://redd.it/15mwp6c
@r_bash
how do i test for 5 digits only ie i tried
grep -rE "[0-9\]{5}"
​
https://redd.it/15mwp6c
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
Everything Hijacked
Some mf on here said I can’t comment on an article and wants me to behave first before I have the privilege of communicating my thoughts to people all over the world. This mf literally has no idea who I am but he can silence me.
https://redd.it/15mwvn7
@r_bash
Some mf on here said I can’t comment on an article and wants me to behave first before I have the privilege of communicating my thoughts to people all over the world. This mf literally has no idea who I am but he can silence me.
https://redd.it/15mwvn7
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
How do I make remove all the extra spaces while using jq to read raw html into a JSON string
- My use case is to upload SES templates to AWS for sending emails
- It requires you to have a JSON templates uploaded to SES in a [https://docs.aws.amazon.com/ses/latest/dg/send-personalized-email-api.html!](certain format)
I wrote a bash noscript in jq that does the following thanks to the help from some of the redditors here
```
declare -A confirm_email=( [TemplateName]="confirm-email" [SubjectPart]="Please confirm your email" )
declare -A forgot_password=( [TemplateName]="forgot-password" [SubjectPart]="Reset Password" )
declare -a templates=(confirm_email forgot_password)
for ((i=0; i<"${#templates[*]}"; i++)); do
curr="${templates[$i]}"
TemplateName="${curr}[TemplateName]"
SubjectPart="${curr}[SubjectPart]"
jq -n \
--arg TemplateName "${!TemplateName}" \
--arg SubjectPart "${!SubjectPart}" \
--rawfile html "${manually_created_directory}/${!TemplateName}.html" \
--rawfile text "${manually_created_directory}/${!TemplateName}.txt" \
'
{
"Template": {
"TemplateName": $TemplateName,
"SubjectPart": $SubjectPart,
"HtmlPart": $html,
"TextPart": $text
}
}' > "${automatically_generated_directory}/${!TemplateName}.json"
aws ses update-template --cli-input-json "file://${automatically_generated_directory}/${!TemplateName}.json"
done
```
My generated json file that I can uploaded to AWS SES looks somewhat like this
```
{
"Template": {
"TemplateName": "confirm-email",
"SubjectPart": "Please confirm your ch email",
"HtmlPart": "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n<html xmlns=\"http://www.w3.org/1999/xhtml\" xmlns=\"http://www.w3.org/1999/xhtml\">\n <head>\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n <meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\" />\n <noscript>Please confirm your email on ch</noscript>\n </head>\n <body\n style=\"\n -webkit-text-size-adjust: none;\n box-sizing: border-box;\n color: #74787e;\n font-family: Arial, 'Helvetica Neue', Helvetica, sans-serif;\n height: 100%;\n line-height: 1.4;\n margin: 0;\n width: 100% !important;\n \"\n bgcolor=\"#f2f4f6\"\n >\n <style type=\"text/css\">\n body {\n width: 100% !important;\n height: 100%;\n margin: 0;\n line-height: 1.4;\n background-color: #f2f4f6;\n color: #74787e;\n -webkit-text-size-adjust: none;\n }\n @media only screen and (max-width: 600px) {\n .email-body_inner {\n width: 100% !important;\n }\n .email-footer {\n width: 100% !important;\n }\n }\n @media only screen and (max-width: 500px) {\n .button {\n width: 100% !important;\n }\n }\n </style>\n <span\n class=\"preheader\"\n style=\"\n box-sizing: border-box;\n display: none !important;\n font-family: Arial, sans-serif;\n font-size: 1px;\n line-height: 1px;\n max-height: 0;\n max-width: 0;\n mso-hide: all;\n opacity: 0;\n overflow: hidden;\n visibility: hidden;\n \"\n >Use this link to reset your password. The link is only valid for 24\n hours.</span\n >\n <table\n class=\"email-wrapper\"\n width=\"100%\"\n cellpadding=\"0\"\n cellspacing=\"0\"\n style=\"\n box-sizing: border-box;\n font-family: Arial, sans-serif;\n margin: 0;\n padding: 0;\n width: 100%;\n \"\n bgcolor=\"#f2f4f6\"\n >\n <tr>\n <td\n align=\"center\"\n style=\"\n box-sizing: border-box;\n font-family: Arial, sans-serif;\n
- My use case is to upload SES templates to AWS for sending emails
- It requires you to have a JSON templates uploaded to SES in a [https://docs.aws.amazon.com/ses/latest/dg/send-personalized-email-api.html!](certain format)
I wrote a bash noscript in jq that does the following thanks to the help from some of the redditors here
```
declare -A confirm_email=( [TemplateName]="confirm-email" [SubjectPart]="Please confirm your email" )
declare -A forgot_password=( [TemplateName]="forgot-password" [SubjectPart]="Reset Password" )
declare -a templates=(confirm_email forgot_password)
for ((i=0; i<"${#templates[*]}"; i++)); do
curr="${templates[$i]}"
TemplateName="${curr}[TemplateName]"
SubjectPart="${curr}[SubjectPart]"
jq -n \
--arg TemplateName "${!TemplateName}" \
--arg SubjectPart "${!SubjectPart}" \
--rawfile html "${manually_created_directory}/${!TemplateName}.html" \
--rawfile text "${manually_created_directory}/${!TemplateName}.txt" \
'
{
"Template": {
"TemplateName": $TemplateName,
"SubjectPart": $SubjectPart,
"HtmlPart": $html,
"TextPart": $text
}
}' > "${automatically_generated_directory}/${!TemplateName}.json"
aws ses update-template --cli-input-json "file://${automatically_generated_directory}/${!TemplateName}.json"
done
```
My generated json file that I can uploaded to AWS SES looks somewhat like this
```
{
"Template": {
"TemplateName": "confirm-email",
"SubjectPart": "Please confirm your ch email",
"HtmlPart": "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n<html xmlns=\"http://www.w3.org/1999/xhtml\" xmlns=\"http://www.w3.org/1999/xhtml\">\n <head>\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n <meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\" />\n <noscript>Please confirm your email on ch</noscript>\n </head>\n <body\n style=\"\n -webkit-text-size-adjust: none;\n box-sizing: border-box;\n color: #74787e;\n font-family: Arial, 'Helvetica Neue', Helvetica, sans-serif;\n height: 100%;\n line-height: 1.4;\n margin: 0;\n width: 100% !important;\n \"\n bgcolor=\"#f2f4f6\"\n >\n <style type=\"text/css\">\n body {\n width: 100% !important;\n height: 100%;\n margin: 0;\n line-height: 1.4;\n background-color: #f2f4f6;\n color: #74787e;\n -webkit-text-size-adjust: none;\n }\n @media only screen and (max-width: 600px) {\n .email-body_inner {\n width: 100% !important;\n }\n .email-footer {\n width: 100% !important;\n }\n }\n @media only screen and (max-width: 500px) {\n .button {\n width: 100% !important;\n }\n }\n </style>\n <span\n class=\"preheader\"\n style=\"\n box-sizing: border-box;\n display: none !important;\n font-family: Arial, sans-serif;\n font-size: 1px;\n line-height: 1px;\n max-height: 0;\n max-width: 0;\n mso-hide: all;\n opacity: 0;\n overflow: hidden;\n visibility: hidden;\n \"\n >Use this link to reset your password. The link is only valid for 24\n hours.</span\n >\n <table\n class=\"email-wrapper\"\n width=\"100%\"\n cellpadding=\"0\"\n cellspacing=\"0\"\n style=\"\n box-sizing: border-box;\n font-family: Arial, sans-serif;\n margin: 0;\n padding: 0;\n width: 100%;\n \"\n bgcolor=\"#f2f4f6\"\n >\n <tr>\n <td\n align=\"center\"\n style=\"\n box-sizing: border-box;\n font-family: Arial, sans-serif;\n
Amazon
Using templates to send personalized email with the Amazon SES API - Amazon Simple Email Service
Use the Amazon SES CreateTemplate and SendBulkEmail operations to send personalized messages.
word-break: break-word;\n \"\n >\n <table\n class=\"email-content\"\n width=\"100%\"\n cellpadding=\"0\"\n cellspacing=\"0\"\n style=\"\n box-sizing: border-box;\n font-family: Arial, sans-serif;\n margin: 0;\n padding: 0;\n width: 100%;\n \"\n >\n <tr>\n <td\n class=\"email-masthead\"\n style=\"\n box-sizing: border-box;\n font-family: Arial, sans-serif;\n padding: 25px 0;\n word-break: break-word;\n \"\n align=\"center\"\n >\n <a\n href=\"https://example.com\"\n class=\"email-masthead_name\"\n style=\"\n box-sizing: border-box;\n color: #bbbfc3;\n font-family: Arial, sans-serif;\n font-size: 16px;\n font-weight: bold;\n text-decoration: none;\n \"\n >ch</a\n >\n </td>\n </tr>\n <tr>\n <td\n class=\"email-body\"\n width=\"100%\"\n cellpadding=\"0\"\n cellspacing=\"0\"\n style=\"\n -premailer-cellpadding: 0;\n -premailer-cellspacing: 0;\n border-bottom-color: #edeff2;\n border-bottom-style: solid;\n border-bottom-width: 1px;\n border-top-color: #edeff2;\n border-top-style: solid;\n border-top-width: 1px;\n box-sizing: border-box;\n font-family: Arial, sans-serif;\n margin: 0;\n padding: 0;\n width: 100%;\n word-break: break-word;\n \"\n bgcolor=\"#ffffff\"\n >\n <table\n class=\"email-body_inner\"\n align=\"center\"\n width=\"570\"\n cellpadding=\"0\"\n cellspacing=\"0\"\n style=\"\n box-sizing: border-box;\n font-family: Arial, sans-serif;\n margin: 0 auto;\n padding: 0;\n width: 570px;\n \"\n bgcolor=\"#ffffff\"\n >\n <tr>\n <td\n class=\"content-cell\"\n style=\"\n box-sizing: border-box;\n font-family: Arial, sans-serif;\n padding: 35px;\n word-break: break-word;\n \"\n >\n <h1\n style=\"\n box-sizing: border-box;\n color: #2f3133;\n font-family: Arial, sans-serif;\n font-size: 19px;\n font-weight: bold;\n margin-top: 0;\n \"\n align=\"left\"\n >\n Hi {{name}},\n </h1>\n <p\n style=\"\n box-sizing: border-box;\n color: #74787e;\n font-family: Arial, sans-serif;\n font-size: 16px;\n line-height: 1.5em;\n margin-top: 0;\n \"\n align=\"left\"\n >\n Use the button below to confirm your email on ch.\n <strong\n
style=\"\n box-sizing: border-box;\n font-family: Arial, sans-serif;\n \"\n >This link is only valid for the next 24\n hours.</strong\n >\n </p>\n <table\n class=\"body-action\"\n align=\"center\"\n width=\"100%\"\n cellpadding=\"0\"\n cellspacing=\"0\"\n style=\"\n box-sizing: border-box;\n font-family: Arial, sans-serif;\n margin: 30px auto;\n padding: 0;\n text-align: center;\n width: 100%;\n \"\n >\n <tr>\n <td\n align=\"center\"\n style=\"\n box-sizing: border-box;\n font-family: Arial, sans-serif;\n word-break: break-word;\n \"\n >\n <table\n width=\"100%\"\n border=\"0\"\n cellspacing=\"0\"\n cellpadding=\"0\"\n style=\"\n box-sizing: border-box;\n font-family: Arial, sans-serif;\n \"\n >\n <tr>\n <td\n align=\"center\"\n style=\"\n box-sizing: border-box;\n font-family: Arial, sans-serif;\n word-break: break-word;\n \"\n >\n <table\n border=\"0\"\n cellspacing=\"0\"\n cellpadding=\"0\"\n style=\"\n box-sizing: border-box;\n font-family: Arial, sans-serif;\n \"\n >\n <tr>\n <td\n style=\"\n box-sizing: border-box;\n font-family: Arial, sans-serif;\n word-break: break-word;\n \"\n >\n <a\n href=\"{{action_url}}\"\n class=\"button button--blue\"\n target=\"_blank\"\n style=\"\n -webkit-text-size-adjust: none;\n background: #007dcc;\n border-color: #007dcc;\n border-radius: 3px;\n border-style: solid;\n border-width: 10px 18px;\n box-shadow: 0 2px 3px\n rgba(0, 0, 0, 0.16);\n box-sizing: border-box;\n color: #ffffff;\n
display: inline-block;\n font-family: Arial, sans-serif;\n font-size: 16px;\n text-decoration: none;\n \"\n >Confirm Email</a\n >\n </td>\n </tr>\n </table>\n </td>\n </tr>\n </table>\n </td>\n </tr>\n </table>\n <p\n style=\"\n box-sizing: border-box;\n color: #74787e;\n font-family: Arial, sans-serif;\n font-size: 16px;\n line-height: 1.5em;\n margin-top: 0;\n \"\n align=\"left\"\n >\n Thanks, <br />The ch Team\n </p>\n <table\n class=\"body-sub\"\n style=\"\n border-top-color: #edeff2;\n border-top-style: solid;\n border-top-width: 1px;\n box-sizing: border-box;\n font-family: Arial, sans-serif;\n margin-top: 25px;\n padding-top: 25px;\n \"\n >\n <tr>\n <td\n style=\"\n box-sizing: border-box;\n font-family: Arial, sans-serif;\n word-break: break-word;\n \"\n >\n <p\n class=\"sub\"\n style=\"\n box-sizing: border-box;\n color: #74787e;\n font-family: Arial, sans-serif;\n font-size: 12px;\n line-height: 1.5em;\n margin-top: 0;\n \"\n align=\"left\"\n >\n If you’re having trouble with the button above,\n copy and paste the URL below into your web\n browser.\n </p>\n <p\n class=\"sub\"\n style=\"\n box-sizing: border-box;\n color: #74787e;\n font-family: Arial, sans-serif;\n font-size: 16px;\n line-height: 1.5em;\n margin-top: 0;\n \"\n align=\"left\"\n >\n {{action_url}}\n </p>\n </td>\n </tr>\n </table>\n </td>\n </tr>\n </table>\n </td>\n </tr>\n <tr>\n <td\n style=\"\n box-sizing: border-box;\n font-family: Arial, sans-serif;\n word-break: break-word;\n \"\n >\n <table\n class=\"email-footer\"\n align=\"center\"\n
width=\"570\"\n cellpadding=\"0\"\n cellspacing=\"0\"\n style=\"\n box-sizing: border-box;\n font-family: Arial, sans-serif;\n margin: 0 auto;\n padding: 0;\n text-align: center;\n width: 570px;\n \"\n >\n <tr>\n <td\n class=\"content-cell\"\n align=\"center\"\n style=\"\n box-sizing: border-box;\n font-family: Arial, sans-serif;\n padding: 35px;\n word-break: break-word;\n \"\n >\n <p\n class=\"sub align-center\"\n style=\"\n box-sizing: border-box;\n color: #bbbfc3;\n font-family: Arial, sans-serif;\n font-size: 12px;\n line-height: 1.5em;\n margin-top: 0;\n \"\n align=\"center\"\n >\n © 2023 ch. All rights reserved.\n </p>\n </td>\n </tr>\n </table>\n </td>\n </tr>\n </table>\n </td>\n </tr>\n </table>\n </body>\n</html>\n",
"TextPart": "Use this link to confirm your email. The link is only valid for 24 hours.\n\nch ( https://example.com )\n\n************\nHi {{name}},\n************\n\nUse the button below to confirm your email on ch. This link is only valid for the next 24 hours.\n\nConfirm your email ( {{ action_url }} )\n\nThanks,\nThe ch Team\n\nIf you’re having trouble with the button above, copy and paste the URL below into your web browser.\n\n{{action_url}}\n\n© 2023 ch. All rights reserved.\n"
}
}
```
Has a tonne of new lines, extra spaces and what not. How do I tell jq to remove these while reading the rawfile?
https://redd.it/15n1mkl
@r_bash
"TextPart": "Use this link to confirm your email. The link is only valid for 24 hours.\n\nch ( https://example.com )\n\n************\nHi {{name}},\n************\n\nUse the button below to confirm your email on ch. This link is only valid for the next 24 hours.\n\nConfirm your email ( {{ action_url }} )\n\nThanks,\nThe ch Team\n\nIf you’re having trouble with the button above, copy and paste the URL below into your web browser.\n\n{{action_url}}\n\n© 2023 ch. All rights reserved.\n"
}
}
```
Has a tonne of new lines, extra spaces and what not. How do I tell jq to remove these while reading the rawfile?
https://redd.it/15n1mkl
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
One of the insignificant portions of my shell noscript, what do you think?
https://redd.it/15n22f9
@r_bash
https://redd.it/15n22f9
@r_bash
Unwanted expansion - no idea why this is happening in grep with Perl regex
Trying negative lookbehind with grep.
This seems reasonable, show 5 numbers not preceded by 'w':
I get this error:
grep: syntax error in subpattern name (missing terminator)
and this appears in my history:
So the <!w was expanded to wc -l current.csv.
Where is this coming from? How can I avoid it? (tried single and double quote around the regex, same result.
​
https://redd.it/15n1jnz
@r_bash
Trying negative lookbehind with grep.
This seems reasonable, show 5 numbers not preceded by 'w':
echo -e "w12121\n888lj\n123456" | grep -P "(?<!w)[[:digit:]]{5}"I get this error:
grep: syntax error in subpattern name (missing terminator)
and this appears in my history:
echo -e "w12121\n888lj\n123456" | grep -P "(?<wc -l current.csv )[[:digit:]]{5}"So the <!w was expanded to wc -l current.csv.
Where is this coming from? How can I avoid it? (tried single and double quote around the regex, same result.
​
https://redd.it/15n1jnz
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
I wrote a TUI drawing tool in just bash
https://github.com/wick3dr0se/drawin
https://redd.it/15ns0yj
@r_bash
https://github.com/wick3dr0se/drawin
https://redd.it/15ns0yj
@r_bash
GitHub
GitHub - wick3dr0se/drawin: A super minimal TUI drawing tool written in BASH
A super minimal TUI drawing tool written in BASH. Contribute to wick3dr0se/drawin development by creating an account on GitHub.
How do I add a variable as an alias?
I'm not sure if that was a decent enough denoscription, but basically, I'm trying to effectively remove the
​
I'm hoping what I said made sense. I've tried several ideas such as
​
I showed this to a friend in my software class, and she wrote:
​
In case you're wondering/haven't noticed, the full command I want to use is:
​
If I'm lucky enough to have someone help me with this, I could also change:
https://redd.it/15o8igq
@r_bash
I'm not sure if that was a decent enough denoscription, but basically, I'm trying to effectively remove the
--volume= part of mpv --volume =x. I want to input mpv x and for it to set mpv's volume to x, and I want to add this to my .zshrc, as opposed to a noscript, because I know I can make a noscript and just do cd [directory] && ./[noscript].sh && cd or something like that.​
I'm hoping what I said made sense. I've tried several ideas such as
alias mpv=$1 --volume=$1 and even prefaced it with volume=$1 just in case.​
I showed this to a friend in my software class, and she wrote:
alias mpv='volume(){ mpv ~/Music/[playlist]/* --shuffle --no-audio-display --af="volume='$1'" "$2"; unset -f volume; }; volume' which i don't understand, nor does it work.​
In case you're wondering/haven't noticed, the full command I want to use is:
mpv ~/Music/[playlist]/* --volume=x --shuffle --no-audio-display​
If I'm lucky enough to have someone help me with this, I could also change:
alias weather='curl -s `wttr.in/`[location] | head -n -2' To alias weather x='curl -s `wttr.in/`x | head -n -2'.https://redd.it/15o8igq
@r_bash
wttr.in
Weather report: armidale