bash

Run RMarkdown with arguments on the command line

时间秒杀一切 提交于 2021-02-07 05:20:10
问题 I'm trying to run a Rmarkdown file ( myfile.Rmd ) from the command line terminal. This file needs to take an argument to work. We can use this simple file as an example: --- title: "Simple example" output: pdf_document: default --- ```{r read_arg, include=FALSE} args = commandArgs(TRUE) VAR = args[1] ``` ```{r show_var} VAR ``` So, first of all, is it possible to run a Rmarkdown file by reading arguments as done for Rscripts? I mean, not by reading input files as described in this question.

cron job doesn't output to nohup.out

僤鯓⒐⒋嵵緔 提交于 2021-02-07 05:06:01
问题 i have start.sh bash script that is running though CRON JOB on ubuntu server start.sh contains bellow mentioned lines of code path of start.sh is /home/ubuntu/folder1/folder2/start.sh #!/bin/bash crawlers(){ nohup scrapy crawl first & nohup scrapy crawl 2nd & wait $! nohup scrapy crawl 3rd & nohup scrapy crawl 4th & wait } cd /home/ubuntu/folder1/folder2/ PATH=$PATH:/usr/local/bin export PATH python init.py & wait $! crawlers python final.py my issue is if i run start.sh my myself on command

cron job doesn't output to nohup.out

六月ゝ 毕业季﹏ 提交于 2021-02-07 05:05:24
问题 i have start.sh bash script that is running though CRON JOB on ubuntu server start.sh contains bellow mentioned lines of code path of start.sh is /home/ubuntu/folder1/folder2/start.sh #!/bin/bash crawlers(){ nohup scrapy crawl first & nohup scrapy crawl 2nd & wait $! nohup scrapy crawl 3rd & nohup scrapy crawl 4th & wait } cd /home/ubuntu/folder1/folder2/ PATH=$PATH:/usr/local/bin export PATH python init.py & wait $! crawlers python final.py my issue is if i run start.sh my myself on command

cron job doesn't output to nohup.out

懵懂的女人 提交于 2021-02-07 05:04:01
问题 i have start.sh bash script that is running though CRON JOB on ubuntu server start.sh contains bellow mentioned lines of code path of start.sh is /home/ubuntu/folder1/folder2/start.sh #!/bin/bash crawlers(){ nohup scrapy crawl first & nohup scrapy crawl 2nd & wait $! nohup scrapy crawl 3rd & nohup scrapy crawl 4th & wait } cd /home/ubuntu/folder1/folder2/ PATH=$PATH:/usr/local/bin export PATH python init.py & wait $! crawlers python final.py my issue is if i run start.sh my myself on command

Unable to pass '#' character as a command-line argument

前提是你 提交于 2021-02-07 04:41:12
问题 I can't pass strings starting with # as command-line arguments. Here is a simple test: #include <stdio.h> int main(int argc, char *argv[]) { for (int i = 1; i < argc; i++) printf("%s ", argv[i]); putchar('\n'); return 0; } If I input the arguments as follows: 2 4 # 5 6 The value of argc is 3 and not 6 . It reads # and stops there. I don't know why, and I can't find the answer in my copies of The C Programming Language and C Primer Plus . 回答1: # begins a comment in Unix shells, much like // in

Azure Storage Table API REST with Curl

不羁岁月 提交于 2021-02-07 04:38:35
问题 I need help to print an entity with Rest in shell script. I tried several ways, but without success. Here is my code, running it, it will return all entities in my table. But I need it to return only a specific value and that is only using PartitionKey. #!/bin/bash # List the tables in an Azure storage container. storage_account="Secret" table_name="teste" access_key="Secret" table_store_url="table.core.windows.net" authorization="SharedKey" request_method="GET" request_date=$(TZ=GMT LC_ALL

git grep and xargs in Windows Batch file?

风格不统一 提交于 2021-02-07 04:29:18
问题 I am trying to create a Windows friendly .bat implementation of the following .sh script. The top few lines are all fine, just add SET and cd is fine. git grep is fine, however, xargs isn't... What would the git grep | xargs logic look like in .bat ? INFINITY=10000 TOPDIR=$(pwd) METEOR_DIR="./code" cd "$METEOR_DIR" # Call git grep to find all js files with the appropriate comment tags, # and only then pass it to JSDoc which will parse the JS files. # This is a whole lot faster than calling

git grep and xargs in Windows Batch file?

孤街浪徒 提交于 2021-02-07 04:28:45
问题 I am trying to create a Windows friendly .bat implementation of the following .sh script. The top few lines are all fine, just add SET and cd is fine. git grep is fine, however, xargs isn't... What would the git grep | xargs logic look like in .bat ? INFINITY=10000 TOPDIR=$(pwd) METEOR_DIR="./code" cd "$METEOR_DIR" # Call git grep to find all js files with the appropriate comment tags, # and only then pass it to JSDoc which will parse the JS files. # This is a whole lot faster than calling

'find' using regex with variables

半城伤御伤魂 提交于 2021-02-07 04:17:04
问题 Please, help me with the following: Let it be three files: file-aaa.sh file-bbb.sh file-xxx.sh In a bash script I have variables $a=aaa $b=bbb Now, I want to execute something like: find . -name "file-[$a|$b].sh" and expect to get two files in output. What am I doing wrong? 回答1: You can use this find: find . -name "file-$a.sh" -o -name "file-$b.sh" To combine it into one using -regex option: On OSX: find -E . -regex ".*file-($a|$b)\.txt" On Linux: find . -regextype posix-extended -regex ".

'find' using regex with variables

情到浓时终转凉″ 提交于 2021-02-07 04:16:23
问题 Please, help me with the following: Let it be three files: file-aaa.sh file-bbb.sh file-xxx.sh In a bash script I have variables $a=aaa $b=bbb Now, I want to execute something like: find . -name "file-[$a|$b].sh" and expect to get two files in output. What am I doing wrong? 回答1: You can use this find: find . -name "file-$a.sh" -o -name "file-$b.sh" To combine it into one using -regex option: On OSX: find -E . -regex ".*file-($a|$b)\.txt" On Linux: find . -regextype posix-extended -regex ".