I've tried launched zed per the following:
open -a /Applications/Zed.app -n --args "$PWD"
However zed does not respect the passed $PWD and only loads the prior open folder.
alias zed="open -a /Applications/Zed.app -n"
and then
zed . works for me.
Related
My host is windows and I am using docker desktop. When I use the command docker cp to copy files from windows to the container which is Ubuntu the json file would end up containing the carriage-return character (i.e.^M). How can I remove them?
Impediments:
docker cp windows command would copy the json as read-only by root
Docker image pull from somewhere and I only have access to user jovyan whom do not have permission to chmod. docker exec -u 0 would return error Error response from daemon: Multiple IDs found with provided prefix: 0 so I can't just login as root either.
Tried WinSCP to move the file to the container but return error say "Remote side unexpectedly closed network connection". I am using SFTP with hostname as localhost and port no. filled. I left password blank as I don't think there is password required for user jovyan since docker exec would connect to this user directly without asking password.
The simple answer here is to install conversion programs that will convert the line endings and deal with the pesky carriage returns for you, dos2unix is always a good shout.
Install:
sudo apt install dos2unix
Usage:
dos2unix <filename>
^M is the keyboard equivalent of the \r character. sed is a program installed by default in Ubuntu distros so you should be able to run this to remove these characters from the json file in your Ubuntu container:
sed -i 's/\r$//' FILENAME
If you want to know what the command does, here's the info:
sed is a stream editor that can change files
-i means to make modifications in place
s/\r$// is a replacement expression saying to replace \r at the end of lines ($ signifies the end of a line) with nothing
Im trying to run my .sh scipt status.sh via a telegram message:
Ubuntu 20.04.1 LTS server
Telegram-cli with a lua script to action status.sh script
when i send the message "status" to my server via telegram it actions the status.sh script, in this script i have a bunch of stuff that gathers info for me and sends it back to telegram so i can see what the status of my server is, however (i recently did a fresh install of the server) for some reason if the script has a line of code starting with sudo i get:
line 38: /usr/bin/sudo: Permission denied
if i run the script from the command line ./status.sh it runs without any problem!? so im thinking its because it is being called from telegram or lua!?
example of code that generates the error: sudo ifconfig enp0s25 >> file
on the other hand this line works without a problem:
sudo echo Time: $(date +"%H:%M:%S") > file
/usr/bin has 0755 permission set
sudo has 4755 permission set
The following command
sudo ifconfig enp0s25 >> file
would not work if file requires root privilege to be modified.
sudo affects ifconfig but not the redirection.
To fix it:
sudo sh -c 'ifconfig enp0s25 >> file'
As mentioned in Egor Skriptunoff's answer, sudo only affects the command being run with sudo, and not the redirect.
Perhaps nothing is being written to file in your case because ifconfig is writing the output you are interested in to stderr instead of to stdout.
If you want to append both stdout and stderr to file as root, use this command:
sudo sh -c 'ifconfig enp0s25 >> file 2>&1'
Here, sh is invoked via sudo so that the redirect to file will be done as root.
Without the 2>&1, only ifconfig's stdout will be appended to file. The 2>&1 tells the shell to redirect stderr to stdout.
If file can be written to without root, this may simplify to
sudo ifconfig enp0s25 >> file 2>&1
I need to move some files around and when i use the following command i get a connot stat error of move
docker run -v D:/PKS/potree/test/dist:/data1 -v D:/PKS/potree/test/tiles:/data2 -v D:/PKS/potree/test/tmp:/data3 oscar/mpc:v1 mv /data1/execution4/*/* /data1/tmp2
mv: cannot stat '/data1/execution4/*/*': No such file or directory
if i instead run a /bin/bash and manually type the same mv /data1/execution4/*/* /data1/tmp2 it works.
How can this be?
The shell expands your wildcards (or doesn’t, because they match nothing) before ever running docker. You’ll have to tell Docker to run a shell if you want wildcards expanded inside the container.
Thanks to Davis to put my in the right direction.
The answer is to do as following instead:
docker run oscar/mpc:v1 /bin/bash -c "mv /data1/execution22/*/* /data1/out1/"
When using sudo lein run (because some of the files changed by that command need priveleges) I get this message:
WARNING: You're currently running as root; probably by accident.
Press control-C to abort or Enter to continue as root.
Set LEIN_ROOT to disable this warning.
Any idea how or where to set LEIN_ROOT in order to avoid getting this message?
Add LEIN_ROOT=true to the end of /etc/profile. For this change to take effect, enter source /etc/profile to a terminal. Then run the command with sudo -E lein run to preserve environment variables.
If you are doing this over ssh you would need to do all of the above on the server then add source /etc/profile to the start of the ssh command run on the local machine.
ssh user#123.456.789 "source /etc/profile; sudo -E lein run"
I want to do OCR on some of my images, but images are not quite very impressive. So, for cleaning it I wanted to use Fred's ImageMagick Textcleaner script. Command that I gave:-
sh textcleaner.sh input_file output_file -g -e stretch -f 25 -o 20 -t 30 -u -s 1 -T -p 20
This is the arguments which Fred has given on website itself. I am also doing for same sample image. But I don't think so any of my options are working everything is by default. And I keep getting this error also
textcleaner.sh: line 177: type: textcleaner.sh: not found
usage: dirname path
usage: basename string [suffix]
basename [-a] [-s suffix] string [...]
And At last I had to keep the files in same folder where my textcleaner script is. How can I make it global and give the absolute path to it rather than putting the files wherever textcleaner is.
It's a bash script - it says so in the first line - yet you are trying to run it in sh - which is not bash. You need to make the script executable, by running
chmod +x textcleaner
then you can run it properly using:
./textcleaner ... arguments ...
That should make the error message go away. Then try showing us a sample image so we can try and see what the problem is.
In my ImageMagick scripts, the syntax is script name ...arguments... input output. So your command should be
bash textcleaner.sh -g -e stretch -f 25 -o 20 -t 30 -u -s 1 -T -p 20 input_file output_file
See my Pointers For Use (for further configuration) at my home page: http://www.fmwconcepts.com/imagemagick/index.php