Shell programming/[win/Linux] Other related records

Source: Internet
Author: User

1. Get the return value of Command Execution

?

2. Get the return value of Script Execution

#!/bin/bashecho "A test."exit 0

Echo $ ?, Output: 0

3. Execute programs in the background in Linux

In Windows, use the start command and specify the/B Option (if there is log output, add a relocation, for example, 2> log). in Linux, add the & Symbol after the command.

4. What is the role of strip?

After strip is processed, the debugging information is removed, and the execution file size is much smaller. The command is as follows:
# Arm-Linux-strip FFMPEG

5. recursively count the number of directories and files. This function comes from the network.

readsub () {  if [ -f $1 -o "$(ls $1)" = "" ]; then    ((n++)) #recursion outdoor  else    ((n++))    for file in $(ls $1)    do      readsub $1/$file #begin recursion  fi}
# When the file is used as an exit, the directory enters recursion as a parameter, and you can also use find

6. Retrieve the latest revision number from SVN

# Svn_dir is the svn URL 'svn info $ svn_dir | grep Revision: | awk '{print $2} ''' SVN up | grep revision | awk-f''' {print $3}' | awk-F '. ''{print $1 }''

# The two numbers obtained above are equivalent to the latest revision number displayed in the manual update operation, which is not the corresponding number of the latest code. Print 'svn info $ svn_dir' # You can see that, it may be the number after 'last changed rev.

7. Use sh-X to debug the script.

8. In the shell script, ECHO Displays the content with color, and ECHO Displays the content with color. You need to use the-e parameter.

9.
Terminate a process in Windows

Tskill PID

Task Manager ends manually

Ntsd-C q-p pid [Windows built-in tools, help for details]

The results of these processes are not very similar, and they do not understand the principles ..



Related Article

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.