command

ksh storing result of a command to a variable

戏子无情 提交于 2019-12-01 05:26:20
问题 I want to store the result of a command to a variable in my shell script. I cant seem to get it to work. I want the most recently dated file in the directory. PRODUCT= 'ls -t /some/dir/file* | head -1 | xargs -n1 basename' it wont work 回答1: you have two options, either $ or backsticks ` . 1) x=$(ls -t /some/dir/file* | head -1 | xargs -n1 basename) or 2) x=`ls -t /some/dir/file* | head -1 | xargs -n1 basename` echo $x Edit: removing unnecessary bracket for (2). 回答2: The problem that you're

WPF - Handle an ApplicationCommand in the ViewModel

僤鯓⒐⒋嵵緔 提交于 2019-12-01 05:13:00
I bet this has been answered many times over, but... For a simple situation where a button on a UserControl has its command property set to something like Find (ApplicationCommands.Find) how would the ViewModel handle that command? I usually see command handlers wired up with a CommandBinding that gets added to a CommandBindings collection on a UIElement, but my ViewModel doesn't derive from UIElement (should it?). The commands themselves don't expose events to notify when they've been executed, so where should I wire up to get that information? EDIT: I'd like to use stock WPF to solve the

Which command in VBA can count the number of characters in a string variable?

三世轮回 提交于 2019-12-01 04:13:49
Let's say I have this variable: word = "habit" which command in VBA will allow me to count how many characters are there in this variable (in my case it's 5). Important: the variable "word" contains only one word, no spaces, but may have contain numbers and hyphens. Do you mean counting the number of characters in a string? That's very simple Dim strWord As String Dim lngNumberOfCharacters as Long strWord = "habit" lngNumberOfCharacters = Len(strWord) Debug.Print lngNumberOfCharacters Len(word) Although that's not what your question title asks =) Len is what you want. word = "habit" length =

Run a UEFI shell command from inside UEFI application

£可爱£侵袭症+ 提交于 2019-12-01 04:12:11
I'm new to UEFI application development. My requirement is that, I need to run an UEFI shell command from my UEFI application ( app.efi ) source code. Need guidance on how I can do this. Example, cp command in UEFI shell is used to copy a file from one path to another. I want to do this programmatically inside my application ( app.efi ) source code. EDIT: I'm looking for something similar to system("command"); function in Linux . How to achieve this? Calling a UEFI shell command from a UEFI application can be done using the EFI_SHELL_EXECUTE function of EFI_SHELL_PROTOCOL , defined under

Gulp won't work in Jenkins

北城以北 提交于 2019-12-01 03:52:33
I've installed gulp globally (npm install gulp -g). But this isn't working I think. When I'm doing gulp test on my local program it works fine. But when I'm doing a gulp test on my (the same) program from github (on Jenkins), it gives the following error. It won't recognize the gulp command. Can someone help me? Thanks Error in Jenkins: [EnvInject] - Loading node environment variables. Building in workspace C:\Program Files (x86)\Jenkins\workspace\project1 > C:\Program Files (x86)\Git\bin\git.exe rev-parse --is-inside-work-tree # timeout=10 Fetching changes from the remote Git repository > C:

How do I do a one way diff in Linux?

纵然是瞬间 提交于 2019-12-01 03:44:46
问题 How do I do a one way diff in Linux? Normal behavior of diff: Normally, diff will tell you all the differences between a two files. For example, it will tell you anything that is in file A that is not in file B, and will also tell you everything that is in file B, but not in file A. For example: File A contains: cat good dog one two File B contains: cat some garbage one a whole bunch of garbage something I don't want to know If I do a regular diff as follows: diff A B the output would be

MFC resource.h command/message IDs

旧巷老猫 提交于 2019-12-01 03:44:00
问题 I'm working on an MFC application, that got pretty messy over years and over different teams of developers. The resource.h file, which contains all command/message mappings grew pretty big over time, and has lots of problems (like duplicate IDs). I am not proficient with MFC, so the question might sound pretty stupid... MSDN docs mention that Command IDs and Message IDs should not be less than WM_USER and WM_APP correspondingly. I saw that most of the command IDs in resource.h generated by

Display Vim intermediate commands

风格不统一 提交于 2019-12-01 03:04:01
In vimtutor Lesson 2.1: DELETION COMMANDS, there is a note after the #4 item: The letter d will appear on the last line of the screen as you type it. Vim is waiting for you to type w . If you see another character than d you typed something wrong; press <ESC> and start over. However, I do not see intermediate commands in the last line as the note says. How do I enable this? What option should I set in my .vimrc ? You can use :set showcmd That will display the commands as you type it in Vim. The same can also be put into .vimrc Max This 'last line' is the line at bottom of screen. If you don't

WPF - Handle an ApplicationCommand in the ViewModel

别来无恙 提交于 2019-12-01 02:32:21
问题 I bet this has been answered many times over, but... For a simple situation where a button on a UserControl has its command property set to something like Find (ApplicationCommands.Find) how would the ViewModel handle that command? I usually see command handlers wired up with a CommandBinding that gets added to a CommandBindings collection on a UIElement, but my ViewModel doesn't derive from UIElement (should it?). The commands themselves don't expose events to notify when they've been

How can I determine the current directory name in R?

二次信任 提交于 2019-12-01 02:16:55
The only solution I've encountered is to use regular expressions and recursively replace the first directory until you get a word with no slashes. gsub("/\\w*/","/",gsub("/\\w*/","/",getwd())) Is there anything slightly more elegant? (and more portable?) Your example code doesn't work for me, but you're probably looking for either basename or dirname : > getwd() [1] "C:/cvswork/data" > basename(getwd()) [1] "data" > dirname(getwd()) [1] "C:/cvswork" If you didn't know basename (and I didn't), you could have used this: tail(strsplit(getwd(), "/")[[1]], 1) 来源: https://stackoverflow.com/questions