R
R
R02021-08-04 16:24:17
linux
R0, 2021-08-04 16:24:17

How to keep a file open in ubuntu terminal?

task

sudo edit /etc/environment
# At the end of the file add the line JAVA_HOME="/usr/lib/jvm/java-8-oracle"
source /etc/environment
echo $JAVA_HOME

stuck on the second step, I can not save the edited file through the terminal
contral +x
contrl+esc
contrl+o
esc

don't close/save the file

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Antony, 2021-08-04
@RiseOfDeath

If you only need to add a line to the end of the file, isn't it easier to do something like that?

sudo echo "JAVA_HOME=\"/usr/lib/jvm/java-8-oracle\"" >> /etc/environment

spoiler

К стати, если вам не требуется переменная окружения прям везде на уровне системы, то я бы советов сделать это только для текущего пользователя, например как-то так:
echo "export JAVA_HOME=\"/usr/lib/jvm/java-8-oracle\"" >> ~/.bash_profile

F
freemailroot, 2021-08-06
@freemailroot

Use nano

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question