unix

appending file contents as parameter for unix shell command

烈酒焚心 提交于 2020-01-15 03:58:11
问题 I'm looking for a unix shell command to append the contents of a file as the parameters of another shell command. For example: command << commandArguments.txt 回答1: xargs was built specifically for this: cat commandArguments.txt | xargs mycommand If you have multiple lines in the file, you can use xargs -L1 -P10 to run ten copies of your command at a time, in parallel. 回答2: xargs takes its standard in and formats it as positional parameters for a shell command. It was originally meant to deal

appending file contents as parameter for unix shell command

守給你的承諾、 提交于 2020-01-15 03:58:06
问题 I'm looking for a unix shell command to append the contents of a file as the parameters of another shell command. For example: command << commandArguments.txt 回答1: xargs was built specifically for this: cat commandArguments.txt | xargs mycommand If you have multiple lines in the file, you can use xargs -L1 -P10 to run ten copies of your command at a time, in parallel. 回答2: xargs takes its standard in and formats it as positional parameters for a shell command. It was originally meant to deal

date: illegal option — d, Find difference between two dates

久未见 提交于 2020-01-15 03:45:48
问题 I am trying to convert timestamps read from a file from string to date format so that I can find the difference of 2 dates/timestamps. most of the threads/discussions on web show usage of date argument '-d' to convert the string to epoch or to find the difference of two timestamps Find difference between two dates in bash But it looks like my environment/OS doesn't support -d date argument. Below are the details of my env: bash --version GNU bash, version 3.2.52(1)-release (i386-pc-solaris2

Does QProcess::close() raise the unix SIGTERM signal on the process?

你。 提交于 2020-01-15 03:12:13
问题 In Linux/Qt I have a GUI application. The GUI starts up additional child processes using QProcess. To close the child processes I use QProcess::close(). Does QProcess::close() raise the unix SIGTERM signal for the child process? (I have linked to the Qt documentation for QProcess and close() because I can not tell from the documentation if a unix signal is raised...) UPDATE: changed question to ask about a specific unix signal: SIGTERM. 回答1: Today I found out that QProcess::close() does not

writing the output from split command to a separate directory

≡放荡痞女 提交于 2020-01-14 14:39:11
问题 So I'm using split command to split a file into separate lines and save them into a different directory than the current directory which I'm executing the command. split -l 1 -d -a 5 --additional-suffix=.txt file1.dat file toindex/ so i want the output files to be written inside toindex/ , but this gives me a error saying: split: extra operand ‘toindex/’ . This works fine if I don't have the output dir path or don't have the prefix ("file"). How do I get this to work? I need to have the

Installing libhoudini (ARM emulation) on Android 4.2.2. Emulator

我的梦境 提交于 2020-01-14 14:20:49
问题 After about 3 days trying and trying I'm giving up. I've tried to install libhoudini (http://android-x86.sceners.org/en/?p=536) on android 4.2.2 emulator. I need that for a project. I know about the existence of Genymotion and AndroVM but I don't need a virtual box image I need a emulator running on intel x86 with ARM emulation. I also tried to create yaffs2 images from a running Genymotion distrubition and migrate that to android-sdk\system-images\android-17\x86. Unfortunately that doesn't

Inheriting aliases inside UNIX /usr/bin/script

喜夏-厌秋 提交于 2020-01-14 13:50:46
问题 The UNIX "/usr/bin/script" command will create a running transcript of your shell session (see "man script" for more info). However, when inside a script instance, it seems to forget the parent shell's env vars, aliases, etc. The following example demonstrates how the "ll" alias I define is ignored inside "script": zsh> mkdir temp zsh> cd temp zsh> alias "ll=ls -alF" zsh> ll total 24 drwxr-xr-x 2 me mygroup 4096 Feb 18 13:32 ./ drwxr-xr-x 28 me mygroup 8192 Feb 18 13:32 ../ zsh> script a.out

Inheriting aliases inside UNIX /usr/bin/script

只愿长相守 提交于 2020-01-14 13:49:24
问题 The UNIX "/usr/bin/script" command will create a running transcript of your shell session (see "man script" for more info). However, when inside a script instance, it seems to forget the parent shell's env vars, aliases, etc. The following example demonstrates how the "ll" alias I define is ignored inside "script": zsh> mkdir temp zsh> cd temp zsh> alias "ll=ls -alF" zsh> ll total 24 drwxr-xr-x 2 me mygroup 4096 Feb 18 13:32 ./ drwxr-xr-x 28 me mygroup 8192 Feb 18 13:32 ../ zsh> script a.out

Deleting a broken link Unix

丶灬走出姿态 提交于 2020-01-14 13:39:07
问题 I want to delete a broken link, but before that I want to confirm if the link file is present in directory. Let's call the link A : if [ -a A ] then print 'ya A is ther' fi But if A is a broken link then how can I check? 回答1: find -L -type l finds broken symbolic links. First confirm that the file is not a directory or a symbolic link to a directory with test -d (if it's a directory, find would recurse into it). Thus: is_broken_symlink () { case $1 in -*) set "./$1";; esac ! [ -d "$1" ] && [

How to type ^A in unix shell script/VI

守給你的承諾、 提交于 2020-01-14 12:54:07
问题 I am new to unix and writing script to extract data in delimited file format. want to use ^A as delimiter , can you please suggest how to type/insert it 回答1: Type Ctrl + V , then Ctrl + A . According to your system configuration, you may need to type other key sequence. Check the output of stty -a , especially lnext : $ stty -a | grep lnext lnext = ^V; flush = ^O; min = 1; time = 0; ^^^^^^^^^^ 回答2: In vi , you can generally type CTRL-V in insert mode, followed by another control character.