Category ‘Programming’
- TECHPULP |
Bash script to delete blank lines from a file
There are multiple ways of deleting blank lines from a file. This article tells how to use “grep” command to achieve the objective. The “grep” command provides an option “-v” to invert the matching. That means grep finds the lines... - TECHPULP |
How to take password interactively in a Bash shell script
If you are not familiar with interactive bash programming, please read this article as well. Typically “read” command is used to prompt the user to respond and read the input from standard input. The “read” command, by default, shows whatever... - TECHPULP |
How to set time out to interactive prompt in Bash
If you are not familiar with how to show interactive prompt in Bash shell script, please read this article first. Typically “read” command is used to read the response from the user. By default, the “read” command waits forever for... - TECHPULP |
How to show interactive YES/NO prompt in Bash
The Bash shell provides an in-built command “read” to read a line from the standard input. The following sample script prompts user to provide his answer as either “yes” or “no“. [neo@techpulp ~]# cat yesno.sh #!/bin/bash echo -n "Do you... - TECHPULP |
How to insert special symbols in HTML
Special characters can be inserted in HTML content using ampersand symbol. The following table provides complete list. ℵ ℵ α α ∧ ∧ ∠ ∠ ≈ ≈ β β • • ∩ ∩ χ χ ♣ ♣ ≅ ≅ ↵... - TECHPULP |
How to align a HTML element like DIV or table in Center using CSS
To center align a DIV or a table, use “margin” property in CSS. Look at the example HTML file below. <html> </head> <title>DIV center align demo</title> <style> .calign { margin: 0 auto; } div { width: 60%; background-color: #fff; }... - TECHPULP |
How to check if a Bash variable is set or not
There is no direct method in bash to determine if a variable is set or not. But we can use “parameter expansion” feature provided by bash. The following example script determines if bash variables MYVAR and MYVAR1 are set or... - TECHPULP |
WebDAV - Resolve - (405 Method Not Allowed) in response to PROPFIND request for ‘/svn’
While configuring WebDAV with Apache for accessing SVN repository using web service, if there is a small misconfiguration related to “Location” directive you will see the following error: svn: Server sent unexpected return value (405 Method Not Allowed) in response... - TECHPULP |
How to generate random password using Bash shell scripting
All Linux systems have a special device “/dev/urandom” which can throw random bytes while reading. But this device gives binary data which may contain non-printable characters. However as we need human-readable characters for a password, we can pick all alpha-numeric... - TECHPULP |
How to embed binary data in an ELF file
An object file can be created based on a pure binary data file and linked to an application. This application can get the start address, end address and size of binary data dynamically using three symbols that are placed by...