Previously we talked about how to submit a Google Form by the curl command.
In the url, we have to encode the special characters such as whitespace. In shell script, we could do string replace as follow.
${VariableName//Pattern/Replacement}
Previously we talked about how to submit a Google Form by the curl command.
In the url, we have to encode the special characters such as whitespace. In shell script, we could do string replace as follow.
${VariableName//Pattern/Replacement}
Google Forms is a very common way to collect user data nowadays. After you have created the form, you could insert it to your web site and present it with your own style.
Other than that, we could integrate Google Forms with the backend job since we could submit the form through command line. Let’s take a look on the following example.
1. Create a new form on your Google drive. The edit page url should be in the following format.
I would like to get the username who triggered the Jenkins job in the Post build task. At first i thought the Build User Vars Plugin could work but than i realize those variables are only available in the Build process but not the post build action.
Luckily, i found a blog post written by Donald Simpson which help me to solve the problem.
Continue reading Jenkins – Get the build user name in job config
Here is a simple shell script which would read a user input and return you the owner and group of the input path.
check_owner_and_group.sh
#!/bin/sh echo "Please enter a file/folder path:" read target_path echo "You have entered $target_path" if [ -e $target_path ]; then target_owner=$(stat -c %U $target_path) target_group=$(stat -c %G $target_path) echo "$target_path owner is: $target_owner" echo "$target_path group is: $target_group" else echo "$target_path is not a valid path" fi
Continue reading Shell Script – Check file owner and other attributes
This is an example shell script which creates a file with datetime as filename.
eureka.sh
#!/bin/bash echo "Eureka!" > eureka.$(date '+%Y-%m-%d').txt
Done =)
Reference: StackOverflow – linux redirector to log filename with $date variable
By default Finder would not show hidden files. Use the following commands to change this setting.
I have the following shell script to start the Jetty Server in my portable web application in Windows.
start_jetty.bat
start java -DSTOP.PORT=8080 -DSTOP.KEY=stop_jetty -jar start.jar EXIT
Continue reading Maven – Start Jetty Server by Ant task using maven-antrun-plugin
Recently, i have a new task which is adding a user account on a Linux box with UI login shell. My project leader suggests a few tools for me to study and finally i pick the the one called pdmenu.
Continue reading Dialog – Create a Simple Menu for Inexperienced Linux Users
I need to write a program which reads a date string. The program then archives all the data on the server with the input date as an cut off date.
The following java program is based on the tutorial in </dream.in.code>. It reads a date string, validate it and print the number of date difference between today and the input date.
Continue reading Java – Date validation using SimpleDateFormat
In the housekeeping shell script, i would update some files. The following example will try to update the /tmp/test file and display the result.
Continue reading Shell Script – Check if a file is updated