4) Functions
If you write a bit more complexProgram, You will find that the sameCodeAnd you will also find it much easier if we use a function. A function looks like this:
Functionname ()
{
# Inside the body $1 is the first argument given to
During shell programming, you often encounter the problem of getting the file name and file suffix. The general solution is as follows:
1 # Code 2 file = " thisfile.txt " 3 echo " filename :$ {file %. *} " 4 echo "
From: http://share.blog.51cto.com/278008/583382
I wrote a very simple script to upload a file to a directory of HDFS in hadoop. When you enter the file name or directory name, an error occurs sometimes and you need to delete the incorrect
I would like to remind you that this client sends a UDP heartbeat packet to the server through port 6060. The package information is as follows:
17:19:35. 734433 IP 192.168.1.7.32773> 61.152.96.119.6060: UDP, length 2017:19:35. 784568 IP 61.152.96.
1. mv
1) mV-move (rename) files
MV [Option] source dest
MV [Option]... source... directory
Rename source to DEST, or move source (s) to directory.
2) Options
①-F, do not prompt before Overwriting
②-I, prompt before Overwrite
③-N, -- no-
1. Host
1) DNS lookup Utility
Host option {name} [server]
Use/etc/resolv. confMedium serverAs the source of the DNS server
2) Option
-A: lists detailed host name settings for this host.
3) Example
Host www.google.com
2. NSLookup-
1,Mkdir
-M, -- mode = mode set file mode (as in chmod), not a = rwx-umask
-P, -- parents no error if existing, make parent directories as needed
Mkdir-P dir1/dir2 // IfDir1Does not exist, also createDir1
Mkdir-M 755/usr/dir3 // and setMode
2,
EXEC command in Shell
1.-exec parameter in find
In the current directory (including subdirectories), find all TXT files and find the rows containing the string "bin"
Find./-name "*. txt"-exec grep "bin "{}\;
Delete all TXT files in the
Windows cmd command line shell is often used in work, but the commands in it are too unaccustomed, such as using dir for column directories, etc, I prefer more Linux commands.
If you also hate windows cmd command names, you can install coreutils
Source: Old Boy's Linux blog Author: Old Boy
The problem is: 4) known: the content of/etc/hosts is
192.168.1.11 oldboy11.etiantian.org
192.168.1.21 oldboy21.etiantian.org
192.168.1.31 oldboy31.etiantian.org
#192.168.1.111
The terminal on Mac uses the Bourne-again shell command, bash for short.
Bash is a project developed and promoted by GNU.Extended Bourne shell
Bourne shellIs the original shell used by UNIX, authorSteven Bourne
Bash is the internal shell of many
1. Redirect related file descriptors
1) file descriptor
①0 standard input,/dev/stdin->/proc/self/FD/0
②1 standard output,/dev/stdout->/proc/self/FD/1
③2 standard error output,/dev/stderr->/proc/self/FD/2
2) redirection
①> Is 1>
②
③>
1. I want to know which shells have been installed on my machine?
You can view the following two methods:
First:
[Rocrocket @ wupengchong ~] $ CHSH-l
/Bin/sh
/Bin/bash
/Sbin/nologin
/Bin/zsh
Second:
[Rocrocket @ wupengchong ~] $ CAT/etc/shells
/Bin/
1 -- shell Method for reading files
# Use the READ command to read a row of data while read mylinedoecho "line:" $ mylinedone
# Use the READ command to read a row of Data cat datafile.txt | while read mylinedo echo "line:" $ mylinedone
# Read
Part 1ArticleI said that in order to change users' criticism on their console interface, Windows Vista started and planned to change this situation.
The appearance of powershell.
1. compatible with shell commands
To be compatible with
Sometimes you can write your own gadgets and prefer non-graphic interfaces. However, some applications still bring up a reminder to let you know.
Zenity is a very handsome thing. For its usage, refer to its -- help. I will not repeat it here. Here
Generally, the ADB shell command is used during development. In my personal development, apart from some ADB commands, in fact, the basic commands of Linux are also very important, especially during terminal debugging. The development environment is
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service