unix

Unix tr command to convert lower case to upper AND upper to lower case

血红的双手。 提交于 2020-01-23 08:25:21
问题 So I was searching around and using the command tr you can convert from lower case to upper case and vice versa. But is there a way to do this both at once? So: $ tr '[:upper:]' '[:lower:]' or $ tr A-Z a-z will turn: "Hello World ABC" to "hello world abc" but I want it to do: "hELLO wORLD abc" Please help! =) 回答1: This will do what you are looking for: tr '[:upper:][:lower:]' '[:lower:][:upper:]' 回答2: I think tr '[a-zA-Z]' '[A-Za-z]' is more straight forward, and easier to remember. 回答3: You

How can I get a list of all preprocessor symbols used (or defined) within a file?

天大地大妈咪最大 提交于 2020-01-23 08:17:27
问题 I have a number of C /C++ project files. I'd like to know the full list of preprocessor symbols used by the files. Is there a flag to gcc, or is there some tool I can use to get this list. Optionally, if the tool also told me the list of symbols defined by the file, that would be great. 回答1: Use gcc -E -dM <file_list> - preprocess, then output #defines. My gcc is a tad rusty, so I'm not sure whether or not you explicitly need the -E, but try both? For further reference, see this 来源: https:/

How can I get a list of all preprocessor symbols used (or defined) within a file?

ⅰ亾dé卋堺 提交于 2020-01-23 08:16:13
问题 I have a number of C /C++ project files. I'd like to know the full list of preprocessor symbols used by the files. Is there a flag to gcc, or is there some tool I can use to get this list. Optionally, if the tool also told me the list of symbols defined by the file, that would be great. 回答1: Use gcc -E -dM <file_list> - preprocess, then output #defines. My gcc is a tad rusty, so I'm not sure whether or not you explicitly need the -E, but try both? For further reference, see this 来源: https:/

Unaliasing a global alias in zsh

天大地大妈咪最大 提交于 2020-01-23 07:51:34
问题 I had defined a global alias in my zsh shell using "alias -g" . When I am trying to unalias it, the shell throws the following error : "unalias: no such hash table element". Any pointers on how to unalias a globally defined alias? 回答1: You need to escape it while attempting to unalias . Try saying: unalias \aliasname instead of unalias aliasname Since it's a global alias, the shell would substitute it anywhere on the command line unless you escape it. 来源: https://stackoverflow.com/questions

Unaliasing a global alias in zsh

夙愿已清 提交于 2020-01-23 07:51:16
问题 I had defined a global alias in my zsh shell using "alias -g" . When I am trying to unalias it, the shell throws the following error : "unalias: no such hash table element". Any pointers on how to unalias a globally defined alias? 回答1: You need to escape it while attempting to unalias . Try saying: unalias \aliasname instead of unalias aliasname Since it's a global alias, the shell would substitute it anywhere on the command line unless you escape it. 来源: https://stackoverflow.com/questions

is anybody doing anything about 2038 time_t bug? [duplicate]

我的梦境 提交于 2020-01-23 07:49:11
问题 This question already has answers here : Closed 9 years ago . Possible Duplicate: What should we do to prepare for 2038? I don't mean 'people' in the abstract. I mean are you doing anything and if so what? I am an ancient programmer and recall when I wrote COBOL in the late 70's saying to others in my team "you know - this isn't going to work in 2000". To which the reply was "yeah but this system wont be in use by then, that's 25 years away". 2038 is 28 years away. 回答1: I add a disclaimer to

Draw on top of the screen using xlib

纵然是瞬间 提交于 2020-01-23 07:41:50
问题 I want to draw some primitives on top of all windows on the screen. I've found some code in C and tried to port it to use python's xlib: from Xlib.display import Display from Xlib import X from Xlib import protocol display = Display(':0') root = display.screen().root gc = root.create_gc() root.fill_rectangle(gc, 100, 100, 500, 500) But nothing appears on the screen (however, the root window is assigned: grabbing keyboard after it works). How to do this correctly? 回答1: You can draw on root

Zip command without including the compressed dir itself

ⅰ亾dé卋堺 提交于 2020-01-23 07:22:34
问题 Suppose the structure: /foo/bar/ --file1 --file2 --file3 --folder1 --file4 --folder2 --file5 I want to run the unix zip utility, compressing the bar folder and all of it's files and subfolders, from foo folder, but not have the bar folder inside the zip, using only command line. If I try to use the -j argument, it doesn't create the bar folder inside the zip as I want, but doesn't create folder1 and folder2 . Doing -rj doesn't work. (I know I can enter inside bar and do zip -r bar.zip . I

How to transfer binary file in SFTP?

邮差的信 提交于 2020-01-23 06:44:58
问题 How to transfer binary file in SFTP? Will it be same as normal file? Or is there any different process? 回答1: A binary file is a normal file. You are possibly referring to a text/ascii vs. a binary transfer mode, known from an FTP protocol. The FTP protocol defaults to the text/ascii mode, so one usually had to ensure that the mode was switched to the binary not to corrupt the transferred binary files. SFTP protocol also supports a text/ascii vs. binary mode distinction in its newer versions.

How to transfer binary file in SFTP?

瘦欲@ 提交于 2020-01-23 06:44:26
问题 How to transfer binary file in SFTP? Will it be same as normal file? Or is there any different process? 回答1: A binary file is a normal file. You are possibly referring to a text/ascii vs. a binary transfer mode, known from an FTP protocol. The FTP protocol defaults to the text/ascii mode, so one usually had to ensure that the mode was switched to the binary not to corrupt the transferred binary files. SFTP protocol also supports a text/ascii vs. binary mode distinction in its newer versions.