Shell
Shell Script – Add strings to the beginning of files
Here is a shell script to find all txt files and add string “my_begin” to the beginning of files.You can change the string for your target.
Here is a shell script to find all txt files and add string “my_begin” to the beginning of files.You can change the string for your target.
Let’s write a shell script example to make note about how to find the first occurrence position and the last occurrence position of substring in string. Output:
If you have a few zip files in a folder, and the zip file had compressed some child zips, the following shell script can help you to extract them. The compressed information in our example look like: Shell script: #! /usr/bin/bash # find zips in current path files=() find . Read more…
Rename Files’ Suffixes Recursively And Find Folders Find Folders To find all folders in the current path, I wrote a simple shell script file. It ignores invisible folder which path looks like ./.XXX. #! /usr/bin/bash dirs=() find . -type d -print0 >tmpfile while IFS= read -r -d $’\0′; do dirs+=(“$REPLY”) Read more…
The following shell script is used to rename the files suffix at the current directory. After giving it the executable permission, we can use it like Code snippet: Result:
The following shell script is used to rename the files at the current directory. After giving it the executable permission, we can use it like Code snippet: Result:
I always get the error code 127 from my web application. I didn’t figure it out because it’s successful to run the program in the shell environment. The core logic in the calling function is like the following code snippet.
We often use TCP and UDP connections in Internet communication. TCP (Transmission Control Protocol) is connection-oriented, it tracks all data sent. By contrast, UDP (User Datagram Protocol) doesn’t care about datagrams it sent, all information is no sequencing. In other words, UDP is unreliable. Both socket technologies can be used Read more…
Preparation Knowledge SSH is a very useful tool which supports to use all kinds of commands to control remote computer for developers. Before interacting with the server, users are required to login with a username and password to be certified. But it’s inconvenient for us to input password every time Read more…