command-line

Proper way to use a trap to exit a shell-script in ZSH?

时间秒杀一切 提交于 2021-01-03 06:58:23
问题 I'm having trouble getting a trap function in a Zshell-script to work without exiting the shell. I have a simple countdown timer that I want to be able to interrupt using ^C, and when I do I want the trap to change the cursor status in the terminal. My syntax is: #!/bin/zsh trap 'tput cnorm; exit' INT TERM I've also tried: trap 'tput cnorm; kill -9 $$' INT TERM Both interrupts exit the shell entirely. How do I only exit the script and return to the command line? Any guidance will be most

Proper way to use a trap to exit a shell-script in ZSH?

梦想与她 提交于 2021-01-03 06:57:29
问题 I'm having trouble getting a trap function in a Zshell-script to work without exiting the shell. I have a simple countdown timer that I want to be able to interrupt using ^C, and when I do I want the trap to change the cursor status in the terminal. My syntax is: #!/bin/zsh trap 'tput cnorm; exit' INT TERM I've also tried: trap 'tput cnorm; kill -9 $$' INT TERM Both interrupts exit the shell entirely. How do I only exit the script and return to the command line? Any guidance will be most

Run R command from command line

烂漫一生 提交于 2021-01-02 05:29:35
问题 Is there a way to run an R command from the command line? Something like $ R --run '1+1' 2 or even like $ Rscript < '1+1' 2 回答1: The command line option -e does exactly that. Rscript.exe -e "1+1" [1] 2 It is clearly explained in the help which you get if you just run RScript without parameters: Usage: /path/to/Rscript [--options] [-e expr [-e expr2 ...] | file] [args] --options accepted are --help Print usage and exit --version Print version and exit --verbose Print information on progress -

Crop video into a 4x4 grid/tiles/matrix efficiently via command-line ffmpeg?

余生长醉 提交于 2021-01-01 06:39:55
问题 Hello Stackoverflow community! I dread having to ask questions, but there seems to be no efficient way to take a single input video and apply a matrix transformation/split the video into equal sized pieces, preferably 4x4=16 segments per input. I tried using all the libraries such as ffmpeg and mencoder, but having 16 outputs can be as slow as 0.15x. The goal of my project is the split the video into 16 segments, rearrange those segments and combine back into a final video; later reversing

Crop video into a 4x4 grid/tiles/matrix efficiently via command-line ffmpeg?

余生长醉 提交于 2021-01-01 06:37:47
问题 Hello Stackoverflow community! I dread having to ask questions, but there seems to be no efficient way to take a single input video and apply a matrix transformation/split the video into equal sized pieces, preferably 4x4=16 segments per input. I tried using all the libraries such as ffmpeg and mencoder, but having 16 outputs can be as slow as 0.15x. The goal of my project is the split the video into 16 segments, rearrange those segments and combine back into a final video; later reversing

Crop video into a 4x4 grid/tiles/matrix efficiently via command-line ffmpeg?

大城市里の小女人 提交于 2021-01-01 06:37:05
问题 Hello Stackoverflow community! I dread having to ask questions, but there seems to be no efficient way to take a single input video and apply a matrix transformation/split the video into equal sized pieces, preferably 4x4=16 segments per input. I tried using all the libraries such as ffmpeg and mencoder, but having 16 outputs can be as slow as 0.15x. The goal of my project is the split the video into 16 segments, rearrange those segments and combine back into a final video; later reversing

CLI: implement something like git commit (open a text editor and get value)

微笑、不失礼 提交于 2020-12-30 06:34:06
问题 I am making a command line app. I want to allow the user, when they are adding values for things in the terminal, to be able to add the value with their text editor. How does git achieve this? I want to open their default editor, allow them to enter text, and when they save get the value and use that value for my app. Thanks. 回答1: Typically, you do four things: Create a temporary file Fork an external process which execs the program specified in the environment variable $EDITOR , giving the

CLI: implement something like git commit (open a text editor and get value)

a 夏天 提交于 2020-12-30 06:31:48
问题 I am making a command line app. I want to allow the user, when they are adding values for things in the terminal, to be able to add the value with their text editor. How does git achieve this? I want to open their default editor, allow them to enter text, and when they save get the value and use that value for my app. Thanks. 回答1: Typically, you do four things: Create a temporary file Fork an external process which execs the program specified in the environment variable $EDITOR , giving the

Create/Update a Git pull request from command line?

不羁岁月 提交于 2020-12-30 02:28:28
问题 I need to create a git pull-request from the command line, without installing any wrappers or additional software. Is there any way to do so in git? I can't seem to find any official git documentation which supports this. 回答1: Surprisingly (to a lot of people), pull requests are first-class citizens in the git world and not something invented by GitHub. Use git request-pull to create an E-Mail text you could send over to someone who should fetch some revisions from a server. This server could

Create/Update a Git pull request from command line?

有些话、适合烂在心里 提交于 2020-12-30 02:26:23
问题 I need to create a git pull-request from the command line, without installing any wrappers or additional software. Is there any way to do so in git? I can't seem to find any official git documentation which supports this. 回答1: Surprisingly (to a lot of people), pull requests are first-class citizens in the git world and not something invented by GitHub. Use git request-pull to create an E-Mail text you could send over to someone who should fetch some revisions from a server. This server could