R
R
Roman Bolshukhin2021-07-28 12:43:33
bash
Roman Bolshukhin, 2021-07-28 12:43:33

sed error, why?

Hello. The essence of the problem: if run through sh s.sh script works
through cron - no.
mistake:

sed: -e expression #1, char 73: strings for `y' command are different lengths
sed: -e expression #1, char 73: strings for `y' command are different lengths

How to fix?
Thanks
if [ -n "$Downloads_folder" ]; then
  # sed-ом заменяем символы кирилицы на символы латиницы
   TRS=`echo $Downloads_file | sed "y/абвгдезийклмнопрстуфхцы/abvgdezijklmnoprstufxcy/"`
   TRS=`echo $TRS | sed "y/АБВГДЕЗИЙКЛМНОПРСТУФХЦЫ/ABVGDEZIJKLMNOPRSTUFXCY/"`
   #Библиотека замен
   shopt -s nullglob
    TRS=${TRS// /_};
    TRS=${TRS//WEB-DL/};
    TRS=${TRS//_./.};
    TRS=${TRS//1080p/};
    TRS=${TRS//(/};
    TRS=${TRS//)/};
    TRS=${TRS//ч/ch};
    TRS=${TRS//Ч/CH};
    TRS=${TRS//ш/sh};
    TRS=${TRS//Ш/SH};
    TRS=${TRS//ё/jo};
    TRS=${TRS//Ё/JO};
    TRS=${TRS//ж/zh};
    TRS=${TRS//Ж/ZH};
    TRS=${TRS//щ/sh\'};
    TRS=${TRS///SH\'};
    TRS=${TRS//э/je};
    TRS=${TRS//Э/JE};
    TRS=${TRS//ю/ju};
    TRS=${TRS//Ю/JU};
    TRS=${TRS//я/ja};
    TRS=${TRS//Я/JA};
    TRS=${TRS//ъ/\`};
    TRS=${TRS//ъ\`};
    TRS=${TRS//ь/\'};
    TRS=${TRS//Ь/\'}
    echo $TRS
fi

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
Viktor Taran, 2021-07-28
@shambler81

the most common you stupidly specified /scrypt.sh
but in cron there is no $PATH by default
, you need to specify the path to the interpreter
/bin/bash scrypt.sh
, better show what you have in the cron

S
Saboteur, 2021-09-16
@saboteur_kiev

I think a certain locale is set in the user profile, which allows you to work normally with the encoding, but it is not set through crontab.
Look again at your .profile, .bashrc and configure the same for cron.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question