pipe

GDB: Set variable using pipe and awk

痴心易碎 提交于 2020-06-16 17:26:49
问题 I would like to store the executable name of the current inferior in a variable. I way to obtain the executable name in the gdb CLI is the following: pipe info inferiors | awk '{ if ($1 == "*") { print $4} }' But I am unable to store the output of this expression in a variable. The expression uses single and double quotes, which makes gdb complain if it is combined with set and eval . (gdb) set $exec="pipe info inferiors | awk '{ if ($1 == "*") { print $4} }'" Argument to arithmetic operation

GDB: Set variable using pipe and awk

前提是你 提交于 2020-06-16 17:26:29
问题 I would like to store the executable name of the current inferior in a variable. I way to obtain the executable name in the gdb CLI is the following: pipe info inferiors | awk '{ if ($1 == "*") { print $4} }' But I am unable to store the output of this expression in a variable. The expression uses single and double quotes, which makes gdb complain if it is combined with set and eval . (gdb) set $exec="pipe info inferiors | awk '{ if ($1 == "*") { print $4} }'" Argument to arithmetic operation

How to pipe the FFmpeg output to multiple ffplay?

£可爱£侵袭症+ 提交于 2020-05-28 07:33:21
问题 I use the following command to pipe the FFmpeg output to 2 ffplay , but it doesn't work. ffmpeg -ss 5 -t 10 -i input.avi -force_key_frames 00:00:00.000 -tune zerolatency -s 1920x1080 -r 25 -f mpegts output.ts -f avi -vcodec copy -an - | ffplay -i - -f mpeg2video - | ffplay -i - How can I pipe the FFmpeg output to 2 (or more) ffplay? I saw this page but it doesn't work for ffplay. (it is for Linux but my OS is windows) Please help me Thanks 回答1: There's some kind of Tee-Object (alias tee ) in

xargs: command substitution $(…) with pipe doesn't work

风格不统一 提交于 2020-05-25 04:46:08
问题 I'm trying to write short script, and the following command: echo "aaa111 bbb111" | xargs -I {} echo {} | sed 's/111/222/g' returns aaa222 bbb222 , which is what I expect. I expected the next command: echo "aaa111 bbb111" | xargs -I {} echo $(echo {} | sed 's/111/222/g') to return the same, but it returns aaa111 bbb111 ! Why is that? UPD: What I'm trying to achieve: I have many files like pic30-coff-gcc , pic30-coff-ag , etc, and I need to make a symlink for each file, like pic30-gcc -> pic30

difference between pty and a pipe

左心房为你撑大大i 提交于 2020-05-25 04:19:50
问题 I have been reading about ptys from this page's example: http://rachid.koucha.free.fr/tech_corner/pty_pdip.html. I have two questions: What is the difference, or the most important difference, between using a pty and using a pipe? From what I have read, both are for inter-process communication, but with a pty the process can "treat it like a normal terminal". What does that mean? What is a "controlling terminal"? I have read about them but can't understand what they really are. Is the

difference between pty and a pipe

﹥>﹥吖頭↗ 提交于 2020-05-25 04:19:26
问题 I have been reading about ptys from this page's example: http://rachid.koucha.free.fr/tech_corner/pty_pdip.html. I have two questions: What is the difference, or the most important difference, between using a pty and using a pipe? From what I have read, both are for inter-process communication, but with a pty the process can "treat it like a normal terminal". What does that mean? What is a "controlling terminal"? I have read about them but can't understand what they really are. Is the

Why is OPTIND messing my positional params?

淺唱寂寞╮ 提交于 2020-05-24 06:08:28
问题 I have this function: sgrep () { local OPTIND; if getopts i o; then grep --color=auto -P -in "$1" "$2"; shift $((OPTIND-1)); else grep --color=auto -P -n "$1" "$2"; fi | sed -E -n 's/^([0-9]+).*/\1/p' | xargs -I{} vim +"{}" "$2"; stty sane } It should use grep case sensitive, if it is invoke with -i . But when it is, the it put -i is in place of search string and search string is in place of somefile : $ set -x $ sgrep 'somesearch' 'somefile' ---#output--- + sgrep -i 'somesearch' 'somefile' +

Angular 5 custom input pipe loses focus when deleting charcter

允我心安 提交于 2020-05-17 07:45:11
问题 I have an input in with a custom pipe that adds a space every 4 characters inserted. The issue is that if I insert for example "1234 5678" and I go and delete 4, the focus instead of staying there to insert a new character it moves to the end. PIPE import { Pipe, PipeTransform } from "@angular/core"; @Pipe({ name: 'formatBankAcc' }) export class FormatBankAccPipe implements PipeTransform { transform(value: string) { if (value != null) { value = value.replace(/[^\dA-Z]/g, '') .replace(/(.{4})

Getting stdout from console

醉酒当歌 提交于 2020-05-17 05:55:48
问题 I'm trying to make a python script that would clone(ISO image) one usb stick to another using dd if=/dev/sda of=/dev/sdb Here's my problem: I want to create progress bar showing what is done. I tried: Looking at storage space at second usb stick, but this doesn't work beacause ISO image scans also unused space By adding status=progress to dd command I can get progress in terminal but I can't figure how to access stdout from python. I tried subprocess.Popen,run(stdout = PIPE) with and without

Get argument from pipe but also run prompts?

本小妞迷上赌 提交于 2020-05-16 21:59:52
问题 I'm writing a Node script designed to be executed from Bash terminal. It takes a couple of filenames and then asks questions to the user via a prompt about how to process them. I'm using yargs for parsing the command line arguments and prompt-sync for asking the user questions and that all seems to work fine... Except when I pipe an argument to my script like so: echo "file2.md" | .myscript.js --f1 file1.md This works in so far as it compares file1.md and file2.md and I'm using pipe-args in