SHELL syntax error:unexpected end of file hint error

If [-N ' $]Thenecho "111"Elseecho "222"FiExit 0Execute SH my.sh par hint syntax error:unexpected end of file. Error excuse me. Text editing is a file written by Notepad under Windows, running under the Cygwin simulation Linux software environment.

The use of $ in a shell script

$: The script name, relative path, or absolute path depends on how the call is being invoked. If the./dollartest.sh call is in the parent directory, then $ is./dollartest.sh, if it is a full path call, such as "/root/test/dollartest.sh", then $ is "/

Several ways of shell logic and judgment

Test can be understood to be the same as [], [[]] in logic and logic or at times, it can be split into multiple [] [Cmd-a cmd] #!/bin/bash a=23; If [$a-gt 18-a $a-lt] then echo ' Young && handsome ' else echo ' Just so ... " fi

Linux shell implementation of random number of multiple methods (DATE,RANDOM,UUID) __linux

Http://www.cnblogs.com/chengmo/archive/2010/10/23/1858879.html In daily life, random numbers are actually often encountered, want to throw dice, lottery, and draw lots. Oh, very simple can be achieved. So in doing programming, really to design a

Shell script Programming Function Chapter __php

Let's take a look at the return value of the two functions to get the way: #!/bin/bash #函数返回值获取测试. function fun_test () { #在函数内部是不能有其他的任何一条打印语句. Echo } val=$ (fun_test) echo $val Another one: #!/bin/bash #函数返回值获取测试. function fun_test

Linux Classic Shell command finishing __linux

Http://www.ha97.com/4021.html 1. Delete 0-byte filesFind-type f-size 0-exec rm-rf {}; 2. View processArrange by memory from large to smallPS-E-O "%c:%p:%z:%a" |sort-k5-nr 3. By CPU utilization from large to small arrangementPS-E-O "%c:%p:%z:%a"

Shell array length

how Shell arrays operate number of array elements ${#array [@]} all elements of an array ${array[*]} string length ${#str} 1, get the number of elements of the array: array= (Bill Chen Bai Hu); num=${#array [@]}///Get the number of array

Linux Shell bash if parameter __linux

Use in shell programming to determine parameters within the IF statement –b returns True when file exists and is a block file -C Returns True when file exists and is a character file -D returns True when pathname exists and is a directory -E Returns

Shell Instruction Expr Usage guide

In the Linux shell command expr is not very noticeable, but it works very well. So far, I personally think the biggest role is two-arithmetic and string operations. First said arithmetic, in the shell arithmetic not simple subtraction, should write

Linux Shell Pushfiletoremoteserver.sh__linux

Cat pushfiletoremoteservice.sh #!/bin/sh Basedir= "' DirName $ '" arg_cnt=$#If [$ARG _cnt-lt 3]; Then echo "Please use: $ dst_ip sshuser path_app-core" echo "Eg: $1.1.1.1 user/opt/app-core/" Exit fidst_ip=$1; dst_user=$2;if [[[] $ =~. *[^/]$]];

The difference between $ (()), $ (), ' and ${} ' in Linux-shell __linux

command Substitution In Bash, $ () and ' (inverted quotes) are used for command substitution.The command substitution is similar to the variable substitution, which is used to reorganize the command line, complete the command line in the quotation

A detailed explanation of shell expressions

Original:Http://blog.pureisle.net/archives/1352.html The Shell provides a large number of basic operations that are useful in scripting. The Shell evaluates the arithmetic expression you provide, performs an operation expansion, and replaces an

Shell Script if judgment file

-S file file is somefile 0 o'clock [f]: Determines whether it is a file [- X "/bin/ls"]: Determines whether/BIN/LS exists and has executable permissions [-n "$var]": Judge $va      R variable has a value ["$a" = "$b"]: To determine if $a and $b

Uppercase and lowercase conversions in play shell

#!/bin/sh For f in * Todo MV $f ' echo $f | TR "[: Upper:]" [: Lower:] "' Done ---------------------------------------------------------- [: Upper:] [A-z] [: Lower:] [A-z] [:d Igit:] [0-9] [: Alnum:] [0-9 A-z] [: space:] spaces or t a b keys [:

Experimental three-shell program design

 Experimental three shell program design: Shell Foundation Experimental purposes:Further consolidate the basic grammar of Shell programming language and deepen the understanding of the learned knowledge. Experimental requirements1. Use of four

The difference between Su and su in the Linux shell __linux

The difference between Su and Su- The former only switches identities, but the shell environment is still the original user's shell, while the user and the shell environment switch to the new user. The PATH environment variable error will not

MONGDB Shell Scripting Learning

Just started contacting the mongdb shell. Here is a record of the learning process. Open the shell in the console. Linux Environment:/usr/local/mongo/bin/mongo Window Environment: D:\mongodb\mongodb-win32-i386-2.0.6\bin>mongo The basic section

test method for power (adb shell Dumpsys batterystats)

Transferred from: http://www.cnblogs.com/penghong2014/p/6065838.html 1. First download historian.py script, download address: Https://github.com/google/battery-historian2. Unzip the download and go to the

Shell nested conditional statement, as far as possible close to two times to judge

if [$#! = 2] Then if [$ = "H"-O $ = "H"] Then echo "Help Info" Else echo "Error:invalid argument amount! Plz Input 2 directory names! " Fi echo "**************************************************************" echo "* by Richard Zhang, Oct, 2008.

HBase Common shell commands

Enter HBase Shell console $HBASE _home/bin/hbase Shell If you have Kerberos authentication, you need to use the appropriate keytab for authentication (using the Kinit command), and then use the HBase shell to enter the certificate successfully. You

Total Pages: 541 1 .... 241 242 243 244 245 .... 541 Go to: GO

Contact Us

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

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.