It suggested that you use IPython shell instead of Bash/Zsh shells. Please refer to IPython Is the Best Shell for detailed discussions. If you have to use shell commands, it is suggested that you use Linux commands when possible as Linux command are more universal and useful. You can …
Hands on the Python module subprocess
General Tips¶
The method
subprocess.run
is preferred over older high-level APIs (subprocess.call
,subprocess.check_call
andsubprocess.check_output
). The methodsubprocess.Popen
(which powers the high-level APIs) can be used if you need advanced controls. When running a shell command usingsubprocess.run
,Avoid using system shell (i.e., avoid using
shell=True
) for 2 reasons. First, avoid shell injection attack. Second, there is no need for you to manually escape special characters in the command.
Special Characters to Avoid in Strings
This articles talks about special characters to avoid in various places. You might not encounter issues most of the time when violating rules stated below, however, you never know when things will break. It is more for a good-practice suggestion.
String for Shell
- When you pass parameters from one program …
Useful Plugins for Eclipse
Terminal Plug-in
"Terminal Plug-in" is a fully-working command-line terminal for Eclipse.
EasyShell
"EasyShell" allows to open a shell window or file manager from the popup menu in the navigation tree or editor view.
Vrapper
Vrapper provides Vim-like scheme for Eclispe. You can edit code similar as what you do in …
Advanced Use of "head" and "tail"
It is suggested that you use Python instead of Shell to manipulate text files!!
Besides passing an unsigned integer as parameter to the option -n
,
you can also pass a signed integer to it.
When a signed integer is passed to -n
,
it means from/to (inclusive/exclusive similar to …
Print Rows from a Text File
It is suggested that you use Python instead of Shell to manipulate text files!
Please refer to
Advanced Use of "head" and "tail"
on how to use head
and tail
for printing rows from a text file.
These 2 commands are convenient when you want to take head/tail rows …