Automatic code indentation using VIM
Answer:
To auto indent your source code, you can use the built-in feature of vim
1. First highlight the code block using the v and arrow keys
2. Press "=" button.
That's it.
Linux Ask! is a Q & A web site specific for Linux related questions. Questions are collected, answered and audited by experienced Linux users.
Automatic code indentation using VIM
Answer:
To auto indent your source code, you can use the built-in feature of vim
1. First highlight the code block using the v and arrow keys
2. Press "=" button.
That's it.
How to get absolute path in Python?
Answer:
To return the absolute path when you provide shortcut path such as ".", e.g.
import os
print os.path.abspath(".") # print the full path of ., depending where you execute the program
How to change keystore password using keytool?
Answer:
# keytool -storepasswd -keystore keystore-file
How to find a class in a Jar file
Answer:
To find a class file in a given Java Jar file, e.g. to find the class "KeyToken" in the file "selenium-server-standalone.jar",
# jar -tf selenium-server-standalone.jar | grep KeyToken
org/yaml/snakeyaml/tokens/KeyToken.class
How to ignore error in Bash script
Answer:
We have learned in the past on how to show the exit status of a given command.
But is it possible ignore the error and return normal exit code even the command has failed?
Yes, pipe "|| true" to the end of command, e.g.
# foo || true
-bash: foo: command not found
# echo $?
0
As you can see even the command foo was not found, our last exit code is still zero.