Довольно просто:
#/bin/bash
echo -n "Please enter the name of a file to be created: "
read FILENAME
ls -l Assign_7 > $FILENAME
echo >> $FILENAME
ls -l Assign_7 | wc -l >> $FILENAME
Это называется Расширение параметров
, полное объяснение см. В man bash
.
Также существует более короткая форма, которая немного упрощает сценарий и заставляет bash
открывать выходной файл только один раз:
#/bin/bash
echo -n "Please enter the name of a file to be created: "
read FILENAME
exec > $FILENAME
ls -l Assign_7
echo ""
ls -l Assign_7 | wc -l
Эта последняя форма выполняет перенаправление текущей оболочки stdout
в файл, выполнив команду exec> $ FILENAME
, таким образом, вывод всех последующих команд, выполняемых оболочкой, также направляется в этот файл.
yum update openssl
Problema, recibí este siguiente error al intentar actualizar openssl:
Loaded plugins: product-id, refresh-packagekit, rhnplugin, security, subscription-manager
There was an error communicating with RHN. RHN Satellite or RHN Classic support will be disabled. Error communicating with server.
The message was:
Error Class Code: 6001
Error Class Info: RHN is in the process of being decommissioned and systems are no longer able to receive updates or make use of any RHN services. Please see https://access.redhat.com/articles/2979901 for more info.
Setting up Update Process
Could not retrieve mirrorlist https://mirrors.iuscommunity.org/mirrorlist?repo=ius-el6&arch=x86_64&protocol=http
error was 14: Peer cert cannot be verified or peer cert invalid
Error: Cannot retrieve repository metadata (repomd.xml) for repository: ius. Please verify its path and try again.
Obtuve la solución para el código de error 6001. Aquí está el resumen que resolvió ese problema:
mv /etc/yum.repos.d/* /tmp/
rm -rf /var/cache/yum/*
yum clean all
yum repolist
yum update openssl
yum list installed openssl