expansion

Globbing/pathname expansion with colon as separator

白昼怎懂夜的黑 提交于 2019-11-30 06:22:48
How can I convert a string containing glob characters such as /var/lib/gems/*/bin into a colon-separated string of filenames (i.e. PATH compatible) matching the pattern? i.e. echo /var/lib/gems/*/bin will return /var/lib/gems/1.8/bin /var/lib/gems/1.9.1/bin I want /var/lib/gems/1.8/bin:/var/lib/gems/1.9.1/bin instead. The obvious approach is simply to replace the space character with ':' via tr , but that doesn't work if the filename itself contains the space character. Actually, I thought of a better solution: use a shell function. function join() { local IFS=$1 shift echo "$*" } mystring=$

Expansion files in the new Google Play developer console

时光毁灭记忆、已成空白 提交于 2019-11-30 00:30:00
I am trying to upload my app to Google Play using the developer console. As of a week or so ago they have made it so that each app has a unique key string. You have to use the new developer console to get the key for your app. The problem is that there is apparently no way to upload an expansion file, which my app needs, in the new developer console. How then do I get my key, and get my apk with expansion file uploaded to Google Play? Uploading an expansion file was simple with the old console all you had to do is upload it at the same time you were uploading the apk file. What is it that I am

Preprocessor macro expansion to another preprocessor directive

你。 提交于 2019-11-29 02:17:39
Initially I thought I needed this, but I eventually avoided it. However, my curiosity (and appetite for knowledge, hum) make me ask: Can a preprocessor macro, for instance in #include "MyClass.h" INSTANTIATE_FOO_TEMPLATE_CLASS(MyClass) expand to another include, like in #include "MyClass.h" #include "FooTemplate.h" template class FooTemplate<MyClass>; ? I believe that cannot be done, this is because the pre-processor is single pass . So it cannot emit other preprocessor directives. Specifically, from the C99 Standard (6.10.3.4 paragraph 3): 3 The resulting completely macro-replaced

Gnuwin32 find.exe expands wildcard before performing search

爷,独闯天下 提交于 2019-11-28 21:22:47
I am using Gnuwin32 binaries on a Windows environment. When I want to find files of a certain type, let's say PDF, I usually run: find . -iname '*.pdf' -print This works perfectly on any UNIX system. find.exe . -iname "*.pdf" -print But under Windows, having replaced single quotes with double-quotes, it only works when there is no pdf file in the current directory, otherwise the * gets expanded . Worse: when there is exactly one PDF file in the current directory, it will expand, there will be no syntax error and you will get wrong results. I have tried escaping the * with a caret, a backslash,

Generate All Possible Matches of a Regular Expression [closed]

北慕城南 提交于 2019-11-28 13:06:45
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 4 years ago . How can I derive all possible matches of a regular expression For example: ((a,b,c)o(m,v)p,b) The strings generated from above expression would be: aomp bomp comp aovp bovp covp b 回答1: Your steps are pretty straight forward though implementing them may take a bit of work: Create a

Loop over array, preventing wildcard expansion (*)

你离开我真会死。 提交于 2019-11-28 12:25:36
I'm trying to figure out what I thought would be a trivial issue in BASH, but I'm having difficulty finding the correct syntax. I want to loop over an array of values, one of them being an asterisk (*), I do not wish to have any wildcard expansion happening during the process. WHITELIST_DOMAINS="* *.foo.com *.bar.com" for domain in $WHITELIST_DOMAINS do echo "$domain" done I have the above, and I'm trying to get the following output: * *.foo.com *.bar.com Instead of the above, I get a directory listing on the current directory, followed by *.foo.com and *.bar.com I know I need some escaping or

Is it possible for C preprocessor macros to contain preprocessor directives?

浪子不回头ぞ 提交于 2019-11-28 06:46:40
I would like to do the equivalent of the following: #define print_max(TYPE) \ # ifdef TYPE##_MAX \ printf("%lld\n", TYPE##_MAX); \ # endif print_max(INT); Now the #ifdef or any nested preprocessor directive is not allowed as far as I can see in a function macro. Any ideas? Update: So it seems like this is not possible. Even a hack to check at runtime seems unachievable. So I think I'll go with something like: #ifndef BLAH_MAX # define BLAH_MAX 0 #endif # etc... for each type I'm interested in #define print_max(TYPE) \ if (TYPE##_MAX) \ printf("%lld\n", TYPE##_MAX); print_max(INT); print_max

Why $'\\0' or $'\\x0' is an empty string? Should be the null-character, isn't it?

匆匆过客 提交于 2019-11-28 05:57:19
bash allows $' string ' expansion. My man bash says: Words of the form $' string ' are treated specially. The word expands to string , with backslash-escaped characters replaced as specified by the ANSI C standard. Backslash escape sequences, if present, are decoded as follows: \a alert (bell) \b backspace \e \E an escape character \f form feed \n new line \r carriage return \t horizontal tab \v vertical tab \ backslash \' single quote \" double quote \ nnn the eight-bit character whose value is the octal value nnn (one to three digits) \x HH the eight-bit character whose value is the

Preprocessor macro expansion to another preprocessor directive

回眸只為那壹抹淺笑 提交于 2019-11-27 16:33:16
问题 Initially I thought I needed this, but I eventually avoided it. However, my curiosity (and appetite for knowledge, hum) make me ask: Can a preprocessor macro, for instance in #include "MyClass.h" INSTANTIATE_FOO_TEMPLATE_CLASS(MyClass) expand to another include, like in #include "MyClass.h" #include "FooTemplate.h" template class FooTemplate<MyClass>; ? 回答1: I believe that cannot be done, this is because the pre-processor is single pass . So it cannot emit other preprocessor directives.

Gnuwin32 find.exe expands wildcard before performing search

亡梦爱人 提交于 2019-11-27 13:57:57
问题 I am using Gnuwin32 binaries on a Windows environment. When I want to find files of a certain type, let's say PDF, I usually run: find . -iname '*.pdf' -print This works perfectly on any UNIX system. find.exe . -iname "*.pdf" -print But under Windows, having replaced single quotes with double-quotes, it only works when there is no pdf file in the current directory, otherwise the * gets expanded . Worse: when there is exactly one PDF file in the current directory, it will expand, there will be