bash

What does the command 'source' do?

江枫思渺然 提交于 2021-02-13 17:38:18
问题 I would like to know what does the command source do. I have tried: whatis $ whatis source source: nothing appropriate. man $ man source No manual entry for source source (-h, --help, etc...) $ source source: not enough arguments But it seems no documentation about it. I commonly use it to save any changed on my dotfiles, but what does it exactly do? Why there is not documentation about it? 回答1: source is a bash shell built-in command that executes the content of the file passed as an

Blank variable during bash command substitution

微笑、不失礼 提交于 2021-02-13 17:04:32
问题 I am doing command substitution and saving the result to a variable. However, the results of the command contain double quotes and this is causing the variable to be empty. When running test="$(java -version)" I get the following result: openjdk version "1.8.0_65" OpenJDK Runtime Environment (build 1.8.0_65-b17) OpenJDK 64-Bit Server VM (build 25.65-b01, mixed mode) However running echo $test yields a blank line. 回答1: The reason that test="$(java -version)" prints the result to the terminal

Blank variable during bash command substitution

元气小坏坏 提交于 2021-02-13 17:03:52
问题 I am doing command substitution and saving the result to a variable. However, the results of the command contain double quotes and this is causing the variable to be empty. When running test="$(java -version)" I get the following result: openjdk version "1.8.0_65" OpenJDK Runtime Environment (build 1.8.0_65-b17) OpenJDK 64-Bit Server VM (build 25.65-b01, mixed mode) However running echo $test yields a blank line. 回答1: The reason that test="$(java -version)" prints the result to the terminal

Blank variable during bash command substitution

梦想的初衷 提交于 2021-02-13 17:03:04
问题 I am doing command substitution and saving the result to a variable. However, the results of the command contain double quotes and this is causing the variable to be empty. When running test="$(java -version)" I get the following result: openjdk version "1.8.0_65" OpenJDK Runtime Environment (build 1.8.0_65-b17) OpenJDK 64-Bit Server VM (build 25.65-b01, mixed mode) However running echo $test yields a blank line. 回答1: The reason that test="$(java -version)" prints the result to the terminal

Rename multiple files while keeping the same extension on Linux

廉价感情. 提交于 2021-02-13 16:37:09
问题 I have 100s of files in a directory with the following naming convention. 00XYZCD042ABCDE20141002ABCDE.XML 00XYZCC011ABCDE20141002.TXT 00XYZCB165ABCDE20141002ABCDE.TXT 00XYZCB165ABCDE20141002ABCDE.CSV I want to rename these files using bash , awk , cut , sed , so that I get the output: XYZCD042.XML XYZCC011.TXT XYZCB165.TXT XYZCB165.CSV So basically, remove the first two 0s always, and then keep everything until ABCDE starts and then remove everything including ABCDE and keep the file

Rename multiple files while keeping the same extension on Linux

筅森魡賤 提交于 2021-02-13 16:35:47
问题 I have 100s of files in a directory with the following naming convention. 00XYZCD042ABCDE20141002ABCDE.XML 00XYZCC011ABCDE20141002.TXT 00XYZCB165ABCDE20141002ABCDE.TXT 00XYZCB165ABCDE20141002ABCDE.CSV I want to rename these files using bash , awk , cut , sed , so that I get the output: XYZCD042.XML XYZCC011.TXT XYZCB165.TXT XYZCB165.CSV So basically, remove the first two 0s always, and then keep everything until ABCDE starts and then remove everything including ABCDE and keep the file

How to delete rows from a csv file based on a list values from another file?

佐手、 提交于 2021-02-13 12:16:43
问题 I have two files: candidates.csv : id,value 1,123 4,1 2,5 50,5 blacklist.csv : 1 2 5 3 10 I'd like to remove all rows from candidates.csv in which the first column ( id ) has a value contained in blacklist.csv . id is always numeric. In this case I'd like my output to look like this: id,value 4,1 50,5 So far, my script for identifying the duplicate lines looks like this: cat candidates.csv | cut -d \, -f 1 | grep -f blacklist.csv -w This gives me the output 1 2 Now I somehow need to pipe this

How to delete rows from a csv file based on a list values from another file?

百般思念 提交于 2021-02-13 12:15:52
问题 I have two files: candidates.csv : id,value 1,123 4,1 2,5 50,5 blacklist.csv : 1 2 5 3 10 I'd like to remove all rows from candidates.csv in which the first column ( id ) has a value contained in blacklist.csv . id is always numeric. In this case I'd like my output to look like this: id,value 4,1 50,5 So far, my script for identifying the duplicate lines looks like this: cat candidates.csv | cut -d \, -f 1 | grep -f blacklist.csv -w This gives me the output 1 2 Now I somehow need to pipe this

安装Conda并在Conda下安装jupyter notebook

核能气质少年 提交于 2021-02-13 11:51:29
Python科学计算环境conda的下载 Conda官方主页: https://github.com/conda/conda Conda官方下载地址: Conda官方下载 我是x86_64 linux系统,所以下载 https://repo.continuum.io/miniconda/Miniconda2-latest-Linux-x86_64.sh conda的安装 bash Miniconda3-latest-Linux-x86_64.sh 注意:安装完成后,conda下的bin文件会添加到环境变量里面,这时候需要source一下bash文件 source ~/.bashrc conda的卸载 rm -rf ~/miniconda 并修改~/.bash_profile中的环境变量,去除家目录中隐藏的.condarc文件.conda文件和.continuum目录 rm -rf ~/.condarc ~/.conda ~/.continuum conda的使用 1.查看已经安装的包 conda list 2.查看可用软件包 conda search 3.在 conda 环境中安装 Jupyter notebook,请使用: conda install jupyter notebook 4.也可以通过 pip 来获得 Jupyter notebook pip install

Docker运行Nginx服务器

旧巷老猫 提交于 2021-02-13 11:50:00
一、获取Docker容器的Nginx镜像 二、创建Docker容器宿主机挂载目录 # 创建挂载目录,- v 显示创建的目录名 [root@idclooknet ~]# mkdir -vp /opt/docker_cfg/nginx/html /opt/docker_cfg/nginx/logs /opt/docker_cfg/nginx/conf 三、添加Nginx基本配置到挂载的配置文件 #新建nginx配置文件 nginx.conf,并添加配置 [root@idclooknet conf]# touch nginx.conf #nginx配置文件的配置如下 [root@idclooknet conf]# cat nginx.conf user nginx; worker_processes 1 ; error_log /var/log/nginx/ error.log warn; pid /var/run/ nginx.pid; events { worker_connections 1024 ; } http { include /etc/nginx/ mime.types; default_type application /octet- stream; log_format main ' $remote_addr - $remote_user [$time_local]