4
votes
3answers
199 views

How can I delete a trailing newline in bash?

I'm looking for something that behaves like Perl's chomp. I'm looking for a command that simply prints its input, minus the last character if it's a newline: $ printf "one\ntwo\n" | ...
2
votes
2answers
341 views

Shell script works when saved with nano but not when saved with Notepad++

I've been working on a bash script all day and have been testing on the machine I will be using it on. When I copy the script across from Notepad++ into a new file with nano editor inside SSH and ...
2
votes
3answers
292 views

Convert newline-delimited list with spaces into arguments

I'm trying to write a script that I can run from the context menu in Caja (a clone of Nautilus). Its purpose is to pass the files that are selected in the file manager to a given program (for example, ...
1
vote
0answers
36 views

(standard_in) 1: parse error [duplicate]

This is my script: #!/bin/sh # 5. Write a Shell Program to Find the Area & Circumference of a Circle echo "Enter the Radius" read radius arear=`echo 3.14 \* $radius \* $radius |bc` circu=`echo 2 ...
2
votes
2answers
185 views

Directories are listed twice

I have something odd. I creates some directories using a very simple script : ... create all directories ( running under a user that has the correct rights ) e.g : mkdir -p ...
0
votes
1answer
2k views

Script failing with “command not found: ^M”

When I try to run the following script in zsh, via the command /bin/zsh ~/.set_color_scheme.sh I get the following error: command not found: ^M The script has u+x permissions and it used to work on ...