bash

Why must I source .bashrc every time I open terminal for aliases to work?

断了今生、忘了曾经 提交于 2021-02-07 08:02:20
问题 Git was working fine. I have created an alias in Git but the issue is when I tried to reopen the terminal, then I need to run . ~/.bashrc every time in the terminal. What is the best way I don't need to provide source every time when I reopen the terminal? What I did? I am trying to add source of the .bashrc file in this file but it is a read-only file. I am not able to add the source of the .bashrc file in this profile. open /etc/profile Added the permission to write in the profile as well,

Run shell script for every file in directory

◇◆丶佛笑我妖孽 提交于 2021-02-07 07:14:57
问题 I have a bunch of files in a directory all named YYYY_MM_DD -rw-r--r-- 1 root root 480K Apr 21 13:17 2012_04_05 -rw-r--r-- 1 root root 483K Apr 21 13:17 2012_04_06 -rw-r--r-- 1 root root 484K Apr 21 13:17 2012_04_07 -rw-r--r-- 1 root root 480K Apr 21 13:17 2012_04_08 -rw-r--r-- 1 root root 344K Apr 21 13:17 2012_04_09 -rw-r--r-- 1 root root 66K Apr 21 13:17 2012_04_10 -rw-r--r-- 1 root root 461K Apr 21 13:17 2012_04_11 -rw-r--r-- 1 root root 475K Apr 21 15:09 2012_04_17 -rw-r--r-- 1 root root

Run shell script for every file in directory

ぐ巨炮叔叔 提交于 2021-02-07 07:14:05
问题 I have a bunch of files in a directory all named YYYY_MM_DD -rw-r--r-- 1 root root 480K Apr 21 13:17 2012_04_05 -rw-r--r-- 1 root root 483K Apr 21 13:17 2012_04_06 -rw-r--r-- 1 root root 484K Apr 21 13:17 2012_04_07 -rw-r--r-- 1 root root 480K Apr 21 13:17 2012_04_08 -rw-r--r-- 1 root root 344K Apr 21 13:17 2012_04_09 -rw-r--r-- 1 root root 66K Apr 21 13:17 2012_04_10 -rw-r--r-- 1 root root 461K Apr 21 13:17 2012_04_11 -rw-r--r-- 1 root root 475K Apr 21 15:09 2012_04_17 -rw-r--r-- 1 root root

Vim: read modeline after opening the file?

。_饼干妹妹 提交于 2021-02-07 06:49:35
问题 I work on a variety of projects and many of them set file-specific vim settings. I have been asked to not have modelines set in .vimrc; is there a way after loading the file to load the modelines settings? So if I open tmp.c with vim: int main(int argc, char* argv[]) { return 0; } /* vim: set expandtab tabstop=4 : */ Is there a command I can run to set the stuff in the modeline? Just doing :set modeline after it is open doesn't do anything. 回答1: After :set modeline , reload your buffer with

How to pass the output of a bash command to Github Action parameter

与世无争的帅哥 提交于 2021-02-07 06:34:30
问题 I have a workflow where after a push to master I want to create a release and upload an asset to it. I'm using actions/create-release@v1 and actions/upload-release-asset@v1 . I would like to pass the outputs of a bash commands to the action parameters. However I found out the syntax of "$(command)" does not work. How can I pass the output of a bash command to an action's parameter. For example I'd like to do something like this: - name: Create Release id: create_release uses: actions/create

How to pass the output of a bash command to Github Action parameter

你说的曾经没有我的故事 提交于 2021-02-07 06:34:09
问题 I have a workflow where after a push to master I want to create a release and upload an asset to it. I'm using actions/create-release@v1 and actions/upload-release-asset@v1 . I would like to pass the outputs of a bash commands to the action parameters. However I found out the syntax of "$(command)" does not work. How can I pass the output of a bash command to an action's parameter. For example I'd like to do something like this: - name: Create Release id: create_release uses: actions/create

Specify which shell Yarn uses for running scripts

折月煮酒 提交于 2021-02-07 06:13:48
问题 My package.json has a script in it like this: "buildTslint": "node_modules/typescript/bin/tsc node_modules/awesomeLibrary_node_tslint/{,helpers/}*.ts", Note the {,helpers/}*.ts part, this is called Brace Expansion and is only possible in bash , not sh . When running yarn buildTslint I get the following output: # yarn buildTslint yarn buildTslint v0.22.0 $ node_modules/typescript/bin/tsc node_modules/awesomeLibrary_node_tslint/{,helpers/}*.ts error TS6053: File 'node_modules/awesomeLibrary

Bash: for loop in Makefile: unexpected end of file

笑着哭i 提交于 2021-02-07 05:26:04
问题 I am writing a Makefile, which will list all headers included by a.cpp, b.cpp and c.h files. However, I got the error of unexpected EOF. Similar questions are always caused by the line terminator, like they used CRLF instead of LF for an EOL. However, my Text editor was set to using LF and I recheck this by delete all EOL and re-added. Unfortunately, the error still remains. Here are the codes: #!/bin/bash list-header: for file in a.cpp b.cpp b.h do echo "$file includes headers: " grep -E '^

Run RMarkdown with arguments on the command line

不打扰是莪最后的温柔 提交于 2021-02-07 05:21:59
问题 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.

Run RMarkdown with arguments on the command line

半城伤御伤魂 提交于 2021-02-07 05:21:19
问题 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.