When using linux long commands, we usually use a shell script with \ branch to show the parameters more clearly.
At this time, there is a note: you must Enter
immediately after \
, otherwise the following parameters will not be able to be passed in. Because at this time, the program will count the following parameters as a new command.
This article is not about this problem, but another problem I encountered in the process of using multiple line break shell scripts.
The script I ran (simplified most of the parameters) was as follows:
python mb_ae_act.py \
--ch_p 2 \
--batchSize0 1 \
--batchSize 64 \
error:
usage: mb_ae_act.py [-h] [--gpu_id GPU_ID] [--num_workers NUM_WORKERS] [--weight_decay WEIGHT_DECAY] [--p P] [--tbx TBX] [--batchSize BATCHSIZE] [--batchSize0 BATCHSIZE0] [--epochs EPOCHS] [--lr LR] [--opt OPT]
[--ch_p CH_P] [--load] [--pth_tbx PTH_TBX] [--load_epoch LOAD_EPOCH] [--act] [--rect] [--split] [--multiply] [--add] [--deeperRC] [--fix224] [--resample] [--HDD]
mb_ae_act.py: error: unrecognized arguments: \
After many attempts, it was found that the program took the last \
as a parameter, and the correct way of writing should not have the last \
or add a carriage return after it, that is, there are two solutions:
1.
python mb_ae_act.py \
--ch_p 2 \
--batchSize0 1 \
--batchSize 64
2.
python mb_ae_act.py \
--ch_p 2 \
--batchSize0 1 \
--batchSize 64 \
I am a small problem, but I don’t understand the principle of the shell script conversion line. I still take some time to solve the problem. I will record it here. I hope it can help people later.