/bin/sh is the POSIX shell. For questions where portability is important. If the question is about .sh files, tag it with `scripts` instead.

learn more… | top users | synonyms

0
votes
1answer
27 views

Installing Mathematica on Ubuntu 15.10

How do I install using a .sh file on Ubuntu 15.10, I'm specifically trying to install Mathematica. The file I'm wanting to use is Mathematica_10.4.1.sh
0
votes
0answers
8 views

Save time command in a text file [duplicate]

I'm trying to do a script to get the Gera (.class file) output in a range and get the time of system resource usage. My sh file: for i in $(seq 16 20) do echo "$i" time java Gera $i done ...
1
vote
1answer
49 views

Running a bash script from an xsession to toggle startup programs

So I've got an interesting challenge in front of me, running Ubuntu 16.04. I originally created a .xsession file that ran Exec=google-chrome --kiosk http://some-url.com to boot as a kiosk device. ...
0
votes
1answer
35 views

Running .sh file right after login and root login

How can I automatically run a .sh file right after I login with my regular credentials, and my root password. Thanks
-1
votes
1answer
40 views

Executing shell script

I have a script: echo "start" cd ~/GoogleDrive/ drive push path-to-file/ echo "done" which uploads path-to file to my Google Drive account. I can run this script without any problem by sh ...
-1
votes
1answer
31 views

Some programs print errors to stdout instead of stderr, and don't set $? when an error occurs. Why? [closed]

See title. I've seen this twice recently, with both udisks and pacmd, and they are 100 times harder to script because of it. Why do programmers do this? For example, I want to switch the audio output ...
0
votes
3answers
48 views

string “if” statement comparing is string empty

I have problem checking if string is empty. I get first column of ls -l info and try to grep string searching for "x". If string is empty, I should countinue. But whenver string is empty or not, I ...
0
votes
2answers
63 views

Check if input string exists in file

You must read string1, what should I do? Here's my code: #!/bin/sh echo "Enter your sting: " read read string1 if [ grep -q $string1 file.txt ];then echo "Found it" else echo "Sorry this string ...
0
votes
2answers
77 views

Problem installing .sh file

I have this file Mathematica_10.0.0_LINUX.sh that I need to install in my Ubuntu 12.04 LTS. I have already, successfully, run chmod +x Mathematica_10.0.0_LINUX.sh. However, when I run sudo ...
0
votes
1answer
69 views

Get wireless access points name or ssid which do not prompt for password using shell script in ubuntu

I just want to get wireless access points name or ssid list which do not prompt to enter password using shell script in ubuntu. Or I can say that I want to get ssid or wireless access point name list ...
1
vote
1answer
30 views

LiveCD: Running a sh script on startup

I have created sh script that backs up computers to a network location, and I'm trying to make a LiveCD of Ubuntu-Mini Remix 14.04 that will be able to launch the script without a GUI. The script does ...
-1
votes
2answers
109 views

Getting error while starting ubuntu 14.04

Every time I start my system I received this message: Error found when loading /etc/profile: /etc/profile: line 1: syntax error near unexpected token (' /etc/profile: line 1:iamgreat# /etc/profile: ...
2
votes
1answer
42 views

Why to use bash in executing script? [duplicate]

In a former question, I was suggested to execute: sudo bash start-dfs.sh why not sudo start-dfs.sh ? I mean, what difference does bash makes?
1
vote
1answer
79 views

.sh to run terminal command

This is probably insanely simple but I'm sort of new to this and have no idea what I'm doing. Very simply, I have MouseON.sh that when ran, I want it to open a terminal, run a command, then close the ...
1
vote
3answers
334 views

sh: all commands “not found”

I was updating my PATH variable in .bash_profiles and /etc/environment and I rebooted the system (Ubuntu 14.04). After login, I got these errors: -sh: 1: id: not found -sh: 12: [: Illegal number: ...
0
votes
0answers
12 views

Why nano file work's and echo “” >> file not? [duplicate]

I'm doing a shell script where I need to write a file. I'm using echo, as below: sudo echo "text text text" >> file I can not use because I'm not allowed. permission denied But using ...
-1
votes
1answer
35 views

Why am I able to execute a file which has just read permission? [duplicate]

I am able to execute a file which has just read permission: nkrish@maddev2:~$ ls -l NewFile.sh -r--r--r-- 1 nkrish nkrish 14 2016-01-14 12:01 NewFile.sh sh NewFile.sh .. File gets run... ...
1
vote
0answers
18 views

How to make a .desktop file show its progress in terminal? [duplicate]

I have a .desktop file set to 100% upgrade my system when I double click it, and I would like to see the results of what is happening when I click it. It is basically running a shell @ ...
0
votes
1answer
79 views

Script to empty trash [duplicate]

I've created a script to empty my trash. I want to be able to execute it without having to use the terminal. Is there anyway I could do this?
2
votes
1answer
68 views

Create folder loop function doesn't work

I have created a function in a .sh file that creates directories in a loop with 3 parameters int: start, end and folder name name But I am getting the following error: Syntax error: "(" unexpected ...
0
votes
1answer
701 views

I cannot open .sh file in ubuntu 15.04 [duplicate]

I right click and into properties I allow the permision to run as a programe. But still cannot run it. It is still opening in text document file
0
votes
1answer
35 views

Code browsing for scripts

We have cscope and ctags for .c and .h files. Are there any code browsing tools for shell scripts (.sh)?
0
votes
3answers
2k views

Can't run shellscript with sudo

When I try to run my script like this: sudo ./connector.sh It give me this: sudo: ./connector.sh: command not found What am I doing wrong?
2
votes
1answer
10k views

Permission denied when running sh file

I am trying to use an sh file to easily start a screen with my minecraft server console. I named this file mc.sh. I have another sh file in the same directory as mc.sh that runs fine. Here is what is ...
0
votes
0answers
19 views

Alternative for notepad++'s IndentByFold plug-in in gedit (auto-indent) [duplicate]

I have some bash script which I want to beautify/code format. In my windows system i have used notepad++'s IndentByFold plug-in to code format and beautify some php,html file etc and it worked fine. ...
1
vote
3answers
263 views

Bash shell for loop process with two paired variable names

It's common to use bash shell for example to bulk rename plenty files. Usually I used the following structure, for file in ./*.short do # do command done That's for filename with .short extension. ...
1
vote
1answer
152 views

How to update the multiple files without changing file date?

I have replaced word 'merchant' to 'capital' in files founded in the current directory using following command: find * -type f -exec sed -i -e 's/merchant/capital/g' {} \; but above command will ...
1
vote
1answer
402 views

script sh syntax error [closed]

I have this script: #!/bin/bash IP='192.168.1.1' fping -c1 -t300 $IP 2>/dev/null 1>/dev/null if [ "$?" = 0 ] then echo "Host found" else echo "Host not found" fi When I try to run it, ...
0
votes
1answer
429 views

How do I export a variable to the `sh` shell? [duplicate]

Calling export MYVAR=/path/to/whatever from .bashrc obviously works for bash but not for the sh shell. Unfortunately, the Matlab launcher seems hell-bent on using sh and not bash. As such, the ...
0
votes
1answer
93 views

What will be effect of removing sh file in Ubuntu?

i have removed my sh file by mistake. I want to know is it impact on executing a application program? or is it fine? If it effects, then what will be the ways to recover it?
0
votes
1answer
230 views

Open up new terminal and run script with double click in Unity

I want to execute expect -c " spawn ssh user@10.0.0.0 expect \"assword:\" send \"pass\r\" interact " in a new terminal by doing double click in an .sh script. I tried ...
0
votes
1answer
47 views

What is the difference between sh and ./ [duplicate]

When given a binary in a terminal, you can launch it via sh myapp or ./myapp Are there any other ways to launch the app? Is there any difference between sh and ./ ? What do they denote/stand ...
0
votes
1answer
213 views

g++ command not found in sh script

I don't know, maybe this is a duplicate, but I didn't find any help. So, the problem. I have a simple problem - I made a script to automate C++ compiling a bit. Well, there's the script. #!/bin/bash ...
0
votes
1answer
435 views

How to accept root password through shell script [closed]

Is there any way that I can provide root password in the shell script without explicitly entering it through the terminal
3
votes
2answers
53k views

How to install Netbeans 8.0.2 on ubuntu 14.x

I have netbeans downloaded from the netbeans.org site. This is the file name → netbeans-8.0.2-linux.sh I dont know how to install it on ubuntu 14.10 Is there any one can help me install netbeans on ...
0
votes
1answer
232 views

Cross fading several audio files using sox

I'm trying to cross-fade several audio files together with a 3 second cross-fade and join them together in to one file with sox. I can join several files together by the command below but not sure ...
2
votes
3answers
485 views

Why do I have to change into my private bin folder to execute an .sh script?

I have a private bin folder in my home directory. It's is also in my path. If I try to run a script from anywhere else in my system but within that folder, I get sh: 0: Can't open [name of ...
0
votes
2answers
314 views

Help Starting Minecraft Server Ubuntu 14.04

My .sh file to launch the server is not working. I have the file named 'craftbukkit.sh' with this pasted in it (from the bukkit set up wiki) #!/bin/sh BINDIR=$(dirname "$(readlink -fn "$0")") cd ...
0
votes
1answer
80 views

Start program after login in Ubuntu

I try to run Jira after Ubuntu start. In /etc/rc.local I wrote this: cd atlassian/jira/bin; ./start-jira.sh (all directories wrote properly) Where is my mistake? Full rc.local: gists
1
vote
1answer
350 views

Cant read variable from user input in bash

I try to run script of my friend and I get this error when try to input some variable: : bad variable nameead: reload : not foundsh: 10: bin/reload.sh: bin/reload.sh: 11: bin/reload.sh: Syntax ...
0
votes
1answer
333 views

Make all new .sh file executable

One of my script is making new .sh files in /tmp/ folder how can I setup that all new files in /tmp/ folder will get chmod -x automaticaly because my script is failing when trying to run scripts in ...
-1
votes
3answers
92 views

Create a script that takes a word as an argument from the user

echo "Enter your string" read str; How can I put in a check to make sure the user passed in a word, displaying a usage statement if a word was not passed as an argument.
1
vote
4answers
4k views

How Can I Run an Shell Script With .desktop Config File?

I am trying to run a shell script with a .desktop file but it doesn't seem to work, producing an error of There was an error launching the application at each attempt. I have the sh and .desktop files ...
0
votes
1answer
572 views

Echo to file apparently needs double escaping backslash (\\\n) to write \n. Why?

As per the graylog2 docs, I need to add this line to my rsyslog.conf: $template GRAYLOGRFC5424,"<%pri%>%protocol-version% %timestamp:::date-rfc3339% %HOSTNAME% %app-name% %procid% %msg% \n" ...
0
votes
1answer
92 views

Need Help Improving Script

I have a group of folders (L1N-L5N), in which I want to copy from my /home/michael/documents/XXX to my Dropbox folder. At present, I have used the following script: #!/bin/sh cp -ra ...
0
votes
2answers
5k views

Installed TeamSpeak 3, won't open. 14.04

I installed Ubuntu yesterday, and I still struggle with a couple of things but I'm getting used to it. I want to install TeamSpeak 3 to talk with my friends, but I just can't make it like people do on ...
-1
votes
1answer
4k views

Can't run .sh file

Hi i am returning user of ubuntu, and i am trying to get label, and the problem how to run two files sh files in the terminal called: install-sh.sh configure.sh and i have tried to enter from the ...
0
votes
3answers
153 views

Why doesn't this second nohup command run?

Everything runs except the last line: #!/bin/bash xinput set-prop 11 "Device Accel Profile" -1 xinput set-prop 11 "Device Accel Velocity Scaling" 1 xinput set-prop 11 "Device Accel Constant ...
0
votes
1answer
146 views

Use alias inside a script

One of the software tools I'm using requires "sh" to be a symlink to "bash" instead of "dash". Since I don't want to change the default shell to bash for the whole system and I can't change the tool ...
2
votes
1answer
101 views

Why does the “watch” command starts two “watch” and a “sh” process?

When I tried to run watch ps command I got the following result: Every 2.0s: ps Thu Jul 31 14:06:45 2014 PID TTY TIME CMD 4329 pts/1 00:00:00 ...