A script is a sequence of commands or instructions that are executed by an interpreter program rather than compiled into a standalone executable program.

learn more… | top users | synonyms (2)

0
votes
1answer
34 views

how to update the values in config file

I have an Config.yml file i want to update the values like below by using shell script. current file data servers: - uri: http://localhost:5550/service/mgmt/current - displayName: server1 - ...
2
votes
1answer
23 views

Bash script to re-run program when it finishes or crashes

This is what I have so far: until python MyApp.py; do echo "App crashed... restarting..." >&2 sleep 1 done This will re-run the program when it crashes, but not when the program finishes ...
3
votes
5answers
189 views

Comparing multiple options in a bash (string)

I'm trying to enable only certain options when using the read command, and to exit the script if a wrong possibility was entered. Tried many possibilities (array, variables, syntax change), but I'm ...
2
votes
4answers
66 views

Add something to crontab programmatically (over ssh)

I have a deployment script, it must add something to a user crontab (trigger a script that clean logs every XXX days), however this must only be done during the first deployment, or when it needs to ...
0
votes
4answers
1k views

Permission denied when run script via ssh

I wrote script which download via scp and install some packages. SSH keys are added to host and when I run [root@HostB ~]# ./myscript everything is ok and packages are downloaded via scp without ...
4
votes
2answers
59 views

Best way to ensure that a script is run once a period?

I need a certain script to run once a month (others viewing this question may need it to be run once a day/week/year/5-day, etc). I know I can use cron to do so with: 0 0 1 * * ./script.sh But what ...
0
votes
0answers
20 views

cat: jobs_list: No such file or directory

below is my script generated by a program name "Raccoon". I need to run this script on the cluster. I have to run it with the following command: qsub script.sh The cluster generate the following ...
-4
votes
0answers
28 views

I want to shell scripting can anybody assist me on this ? Any website or any online course? [on hold]

I want to shell scripting can anybody assist me on this ...Any website any online course.
1
vote
0answers
50 views

Task Automation With .EXE program and Bash Script?

There's a Windows program called Visipics. It finds similar images, not merely duplicates. I find it superior to findimagedupes (I use it with Manjaro and Linux Mint) and competing Windows programs, ...
-1
votes
1answer
35 views

Adding Function to array based on index [on hold]

I am using Bash. I am trying to add a function to an array. I tried using: if [ $CONTROL -eq 0 ]; then array[$index]+=`function_name1` fi if [ $CONTROL -ge 1 ] && [ $CONTROL -le 20 ]; ...
-2
votes
1answer
75 views

quick and easy way to comment out multi lined print statements

Is there a quick and easy way to comment out multi lined print statements? something like this? printf("3387 strings_line_tokens[lower_bound_of_big_boy_counter] %s \n", ...
3
votes
2answers
102 views

Debian (jessie) with XFCE, Sessions and Startup: Application Autostart

Long-time lurker, first time question-asker. I am running Debian jessie with XFCE, kernel 3.16.7. In the course of setting up Conky to run at startup, I wrote a bash script to... well.. run Conky. ...
-3
votes
0answers
33 views

Script (shell or python) to update a web page every 5 minutes [on hold]

I'm trying to write a script (shell or python) to update a web page every 5 minutes. I tried this: import time from selenium import webdriver driver = webdriver.Firefox() driver.get('https://www....
0
votes
1answer
28 views

How to call a script from one file location in another bash script

I have a script named initTEST.ora at location $ORACLE_HOME/dbs. I want to call initTEST.ora script in another script named test.sh which is present in /home/oracle/script.
5
votes
2answers
402 views

Shell script: if multiple conditions

I want to create a shell script that echos something if 3 directories don't exist. Here is the code I wrote: test.sh: if [ ! -d "/home/unix/POSTagger2" ] || [! -d "/home/unix/POSTagger2/stanford-...
0
votes
1answer
29 views

Backup Script throwing errors

I have the following script: #!/bin/sh #Finds all folders and subsequent files that were modified yesterday and dumps them out to a text updatedb && rm /tmp/* echo $(locate -b `date --date=...
0
votes
1answer
59 views

Sourcing a file multiple times in a bash script

I have a large configuration script (bash) that is pretty well modularized into separate functions to complete a bunch of tasks for installing/configuring a new rollout of a software suite. We have ...
24
votes
6answers
3k views

How can I propagate my SSH pub key to a list of servers without having to type my password in over and over?

I was recently given username/password access to a list of servers and want to propagate my SSH public key to these servers, so that I can login more easily. So that it's clear: There is not any ...
0
votes
1answer
25 views

cannot open file as first argument [duplicate]

I am trying to run a script like : ./script.sh file but I am receiving ( if I use a txt file ): =: cannot open `=' (No such file or directory) test.txt: ASCII text Second If I use a gz ...
0
votes
0answers
59 views

Curl gets 200 OK, while browser shows 503

I have a bash script: code=$(curl -I -s -S --resolve $host:$port:$ip $link | grep 'HTTP/1.' | awk '{ print $2 }') if [ $code -eq 502 -o $code -eq 503 -o $code -eq 504 ]; then /usr/sbin/service ...
2
votes
2answers
166 views

Need special validation for shell script

I want to create a bash script which will have lot of options while executing. # script.sh --dry-run --user <parameter1> --pass <parameter2> I heard about getopt option but looks like ...
6
votes
6answers
9k views

History command inside bash script

I have been bashing my head to write a simple history script for the last two days. History is a shell-built in command I couldn't able to use that within a BASH script. So, Is there a way attain this ...
1
vote
1answer
31 views

Bash scripting [keyboard input needed] [duplicate]

I'm new in Linux and I'm trying to make my first bash script to improve my work at college. Im working with a software called GROMACS and I'm trying to make a script to perfom a bunch of codes at the ...
1
vote
1answer
36 views

xterm not loading xresources properly

There are similar questions out there, however, I was not able to figure out the flaws in my .xinitrc file which causes .Xresources not to load. The respective .xinitrc #!/bin/sh [[ -f ~/.Xresources ...
0
votes
1answer
31 views

How to run a perl script inside another perl script

I have two Perl scripts and want to use one script from another. The scripts are called script1.pl and script2.pl. I want to run the below command inside script1.pl : /home/user/script2.pl /var/log/...
9
votes
1answer
1k views

Can capabilities be used in scripts without setcap'ing the interpreter binary?

Right now I'm using cap_net_bind_service MY_USERNAME in /etc/security/capability.conf. Now I just need to set cap_net_bind_service+i on the interpreter of my favouite scripting language to be able to ...
2
votes
3answers
92 views

Are there any sed scripts built in to mainstream Linux distros?

When I was studying bash, I found it very helpful to go and study the bash scripts already present on a clean install of Linux—/etc/profile, for instance, and anything in /etc/rc.d/init.d/. These are ...
1
vote
0answers
32 views

Integration of `afuse` with `sshfs` as a (systemd?) user-daemon spawned from login or first shell

To facilitate working with remote files, I setup afuse with sshfs to run from my .bashrc. It works, after bash init all my remote trees from ~/.ssh/config/ are mounted on-demand under ~/scp/, but ...
3
votes
0answers
60 views

Performance Optimization

I have one script which roughly has to read 1.5 million lines and process the lines and print out output in cvs file. This script is current taking more than 8-9 hours to process 250 thousands lines. ...
3
votes
2answers
3k views

Pass argument to script, then redirect script as input to bsub

I am currently working with the bsub job submission system from Platform LSF. I need to submit job scripts, but I am running into a problem with passing arguments to the job script. What I need is as ...
2
votes
1answer
202 views

What is the most portable syntax for `if` statements?

(NOTE: There is a very similar question, asked yesterday oddly enough, but it doesn't cover the main syntaxes I'm concerned with. If I were to update the other question to include them it might ...
1
vote
3answers
2k views

Split XML file into multiple files

I have an xml file that have different nodes, I want to split files like this: <unix> <mm> </unix> <osx> <nn> </osx> When I run the script I want it to make ...
2
votes
3answers
173 views

How to remove all lines that have one value in the line?

I have a file as the following input file 0.0 4 6 5 1 2 9 4 5 1 ..... 0.25 0.5 3 1 1.0 3 7 8 2 1.5 3 3 3 4 6 4 5 2.0 2.5 6 7 6 9 I want to delete all lines ...
2
votes
1answer
1k views

How do I get simple scripts which seem to need root priveliges to run via the www-data user?

I am programming a small web interface to control samba on Debian (kernel 2.6.32-5-686). I started by writing simple scripts to add users, create folders, etc. They worked fine when run as root. ...
3
votes
1answer
25 views

Print proper log file from a terminal session

I am trying to log a terminal with the ssh user@ip | tee -a test.log command. But, when I push backspace it prints in the log like: pwe[J[J[Jexit (for example). Is there any specific option ...
0
votes
1answer
27 views

Execute script in new tab command line gnome-terminal

Hello i want to open a new terminal and execute a script immediately to it (to set a title in the new tab) and i cannot configure this. I try: gnome-terminal --tab-with-profile=$varname -x ./test.sh -...
-1
votes
2answers
35 views

Privilegies of command inside shell script

I need to run simple script to check host status (ping), I have following script: #!/bin/bash echo "Host checker:" if [ "`ping -c 1 172.17.10.1`" ] then echo "HOST UP" else echo "HOST DOWN" fi ...
1
vote
5answers
94 views

Killing a named process older than X minutes? (no killall -o)

Okay, first post! So I have this situation where I need to check for a process older than 5 minutes by a particular process name. The problem is that the system in question is a customized version of ...
1
vote
1answer
35 views

`Interact` not working as expected in bash/expect scripting

In order to provision an embedded device (i.e. writing images to flash) a series of very well known commands have to be entered during the boot stage. The algorithm is something like: Capture a ...
0
votes
1answer
33 views

Automatically put content in for read in bash

Hi I have a little bash script and before i used to type the content in a bit like answering a question, but what i would like to do is just run the bash script and instead of answering the question ...
14
votes
3answers
433 views

Replace environment variables in a file with their actual values?

Is there an easy way to substitute/evaluate environment variables in a file? Like let's say I have a file config.xml that contains: <property> <name>instanceId</name> <...
-1
votes
1answer
34 views

cancel script execution and continue [closed]

I have a script which runs another script. myscript.sh #!/bin/bash .... cd /folder/ sh run.sh sh another_script ... the procedure: So , I start running myscript.sh , the script runs it's ...
3
votes
2answers
86 views

How call a function inside another function

I'm working actually in a shell script to monitor a server's resources. I have a function and I want to know: how can I call a second function inside the main one? Example: funct mainfunct(){ echo "...
1
vote
2answers
59 views

chown doesn't work through script

I have a script: #! /bin/bash sudo chown -R $USER:$USER /opt/Folder The chown doesn't seem to execute. If I just write the above line from terminal ,it runs fine though! I have read this but ...
0
votes
2answers
24 views

Bash scripting: Change standard error message for custom one

I have been trying to work on my own little backup script. I am running into an issue when I run my script and the rm command has nothing to do. I would still like to process the output (aka display ...
4
votes
1answer
44 views

Open a new terminal, monitor it and execute a script

I have a script that I want to monitor its results and write them to a log file. I run the following: gnome-terminal -x bash -c "script logfile.log; ssh user@IP" But this command execute first the ...
2
votes
0answers
52 views

Bash completion extra space when adding file directory

I have a script for extending bash-completion for certain commands. If I type command1 and do a tab, it should auto-complete with a file directory (and the files). It works fine expect for one ...
1
vote
1answer
60 views

KSH script having trouble reading in variables line by line

For starters, I'm not the most advanced scripter. I was asked to create a script that would search through a directory for print files older than 14 days and move them to an archive directory. There ...
0
votes
4answers
60 views

Find folders that begin with the same string

I have more than 1000 subdirectories in a folder. Some of them begin with the same string and I want to find all directories where the first 5 characters of their name are also the first 5 of another ...
25
votes
6answers
46k views

File extensions for unix shell scripts

On wikipedia, the article for .sh says: For the .sh file extension type, see Bourne shell. How about other unix shells? I know that the shebang is used inside the file to indicate an ...