bash string operation

Length of string The syntax for obtaining the length of a string is as follows. ${#varname} Here is an example. $ myPath=/home/cam/book/long.file.name $ echo ${#myPath} 29 Braces {} are required, otherwise Bash will interpret $# as the number of script parameters and variable names as text. $ echo $#myvar 0myvar In the above example, ...

Posted by jwright on Mon, 28 Feb 2022 02:55:52 +0100

printf segment error (core dump): a problem caused by formatted output

1. printf segment error (core dump): a problem caused by formatted outputPost a simple example:#include <stdio.h> int main(){ int len = sizeof(int); printf("%s\n",len); return 0; } `root@ubuntu:test#gcc test.c test.c: In function 'main':test.c:5:2: warning: format '%s' expects argument of type 'char *', but argument 2 has typ ...

Posted by anthill on Mon, 28 Feb 2022 02:45:27 +0100

Asynchronous request pool

Asynchronous request pool What is the difference between synchronous and asynchronous? Concept: it is the relationship between the two. For example, processes and processes, or clients and servers. Whether the request will be suspended and wait for return after being called or sent. Synchronization: after calling the interface, the process ...

Posted by fou2enve on Sun, 27 Feb 2022 14:35:04 +0100

Linux producer consumer model

Producer consumer model Concept of producer consumer model Producer consumer model is to solve the strong coupling problem between producers and consumers through a container. Producers and consumers do not communicate directly with each other, but communicate through this container. Therefore, after producing data, producers do not ...

Posted by Awanka on Sun, 27 Feb 2022 10:47:08 +0100

Middleware learning notes - Introduction to Redis

1. Redis (CACHE) 1.1 Nosql 1.1.1 general Single machine mysql era: In the 1990s, the number of visits to a basic website will not be too large, and a single database is enough! More use of static web pages html Website bottleneck: The amount of data is too large for one machineThe index of data can't fit into the memory of a machineToo m ...

Posted by rakennedy75 on Sun, 27 Feb 2022 09:33:32 +0100

Linux kernel programming (08): debugfs file system

1, What is debugfs Introduction: born for debugging kernel, a memory based file system, developed based on libfs, provides powerful debugging function; Advantages over procfs and sysfs: procfs: use procfs to debug the kernel and modify registers, and add a lot of debugging code to its underlying read and write interfaces. sysfs: device model ...

Posted by sillyman on Sun, 27 Feb 2022 08:39:42 +0100

No interaction in shell programming

Here Document interaction free Cross free mutual definition Here Document overview: Use I/O redirection to provide a list of commands to interactive programs or commands, such as ftp, cat, or read commands Here Document is an alternative to standard input, which can help script developers not use temporary files to build input informa ...

Posted by corporateboy on Sun, 27 Feb 2022 05:54:00 +0100

Using shell to realize the function similar to windows recycle bin under linux

When using linux, the rm -rf command is often executed, but this command is risky. For example, execute a shell script, which contains the following statements: # script.sh rm -rf $HOME/$SOME_PATH At this time, if the environment variable HOME is caused by a setting_ If the path is empty, all contents in the HOME directory will be cleared di ...

Posted by shilpa_agarwal on Sun, 27 Feb 2022 05:00:05 +0100

[x86 assembly language: Notes from real mode to protected mode] Chapter 8 access and control of hard disk and graphics card

Objectives of this chapter: Simulate the process of loading applications by the operating system, demonstrate the relocation method of segments, and thoroughly understand the segmented memory management mechanism of 8086 processorLearn the program execution mechanism of x86 processor procedure callUnderstand how x86 processors access periphera ...

Posted by ATS16805 on Sun, 27 Feb 2022 03:56:48 +0100

SSH secret free automatic connection

1. GeneralFor the use of Linux operating system, the importance of SSH is self-evident. However, you have to enter a lengthy user name @ host IP every time you log in, and sometimes you forget the user name / host IP. It is also a waste of time to check the records again, so this time we need to configure the SSH login configured to the server ...

Posted by jamesp on Sun, 27 Feb 2022 03:43:13 +0100