Skip to main content

Timeline for here-document basename conflicts?

Current License: CC BY-SA 4.0

12 events
when toggle format what by license comment
Mar 28, 2019 at 6:40 comment added ilkkachu Which reminds me of an earlier question: Expanding only certain variables inside a heredoc
Mar 28, 2019 at 5:35 comment added user313992 @Molly_K a better way to replace some variable in a here-document is to do it the autoconf way: quote the delimiter so you don't have to escape any $, and then pipe the heredoc to sed, replacing @@var@@ with the value of $var: sed <<-'EOT' >out "s|@@var@@|$var|g"; ... lines containing @@var@@ ... EOT (replace the | with a char that doesn't appear in the value of $var). But, as ilkkachu has said, it may be that you don't really need to autogenerate any scripts.
Mar 27, 2019 at 19:16 comment added ilkkachu There's probably a dozen or so Q&A's about running scripts in parallel here on the site, see e.g. unix.stackexchange.com/q/169326/170373 and unix.stackexchange.com/q/211976/170373 and the search unix.stackexchange.com/…
Mar 27, 2019 at 19:14 comment added ilkkachu @Molly_K, I tried to adapt your script to picking $letter from the command line. For parallel processing, you could write the script so that it processes just one file, and then run xargs -P or use GNU parallel to run a bunch of them at a time.
Mar 27, 2019 at 19:09 history edited ilkkachu CC BY-SA 4.0
added 1082 characters in body
Mar 27, 2019 at 15:15 comment added Molly_K You mentioned that creating "one" script and passing the letter to it as a command line argument. Could you elaborate more on that? My original thought is to break down files based on alphabets and run in parallel. However, if there's a way to break down the files individually and run scripts in parallel would be even better, I should work on that.
Mar 27, 2019 at 15:14 comment added Molly_K Hi @ilkkachu, I wonder if you could let me know if there's a way to escape the "stored as-is" under the cat << 'EOF' circumstance. More specifically, I want ${letter} in both bash script filename and within the script.
Mar 27, 2019 at 15:07 vote accept Molly_K
Mar 27, 2019 at 15:49
Mar 27, 2019 at 14:51 vote accept Molly_K
Mar 27, 2019 at 14:51
Mar 26, 2019 at 21:50 comment added Molly_K Thank you @ilkkachu, great answer and works well!!
Mar 26, 2019 at 21:44 vote accept Molly_K
Mar 26, 2019 at 21:46
Mar 26, 2019 at 21:35 history answered ilkkachu CC BY-SA 4.0