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)

1
vote
2answers
46 views

Stop bash script with any key

I'm writing a custom gnome-terminal profile which I want to stop with any key I choose. After pressing the key, my intention is to complete all my commands at that moment and start su. I've tried ...
0
votes
1answer
13 views

BASH script presenting IF syntax error

for k in {794..800} if [ -f "vesta_$k.xyz" ] then do mkdir $k mv vesta_$k.xyz $k/vesta.xyz cd $k/ <<COMMANDS>> cd .. ...
-1
votes
1answer
18 views

Search for and kill process in script

I have written a script to stop a Tomcat instance, remove the .war file and application directory, copy a new .war file from a NFS mount to the webapps directory, and then restart the Tomcat instance. ...
1
vote
2answers
31 views

legality of creating a variable for a file location

adapter= /Volumes/My\ Passport/Documents/adapters.fa Can I create this variable so that I can just refer to adapter for the exact file (and its location)?
0
votes
1answer
23 views

Rss in full text

I am looking for a way to extract the full text from an html file in the command line. The purpose of this is to make a blocklet for my i3 status bar. I have found some site with names like "Full ...
2
votes
2answers
26 views

Parameter expansion question

I have 2 files each in user/admin/1/2/[a-c] subdirectories. The files are preQC_1.txt and preQC_2.txt - both of which will be inputs in my tool. I use "${f##*/}" for preQC_1.txt in my for loop for ...
2
votes
3answers
185 views

awk : parse and write to another file

I have records in XML file like below. I need to search for <keyword>SEARCH</keyword> and if present then I need to take the entire record and write to another file.(starting from ...
0
votes
4answers
37 views

Rename files randomly but without repetition

Suppose i have a folder with a lot of file names some very strange and nonsense I want to rename it like File-1 File-2 File-3 .. I have tried this(echo is for tryng) for name in *; do echo mv ...
1
vote
1answer
40 views

generate file names in loop [on hold]

DISCLAIMER: I am using Mac OSX. The bash script is in a different directory from the files that require processing. From here my struggle begins… HELP 1: I have multiple files each housed in a ...
0
votes
0answers
41 views

Unix scripting : Writing to another file with “:” is failing

I have below record (and many other such records) in one file 9460 xyz abc (lmn):1027739543798. Taxpayer's identification number (INN): 123. For all IIB. 2016/02/03 I need to search ...
3
votes
2answers
30 views

SSH Connection - Interact with ongoing process

If i open a Terminal window on my desktop and start a job on it and go to work in the morning. Is there a way to connect to the desktop with SSH and interact with the ongoing process in the Terminal ...
0
votes
4answers
48 views

Find files using shell script

I have the below script which looks for the file in the current directory and evaluates to true if the file exists in the directory and evaluates to false if it does not #!/bin/bash printf "\n Please ...
1
vote
2answers
36 views

Renaming a file the moment it appears in a folder

Here's the context : on a samba server, I have some folders (that we'll call A,B,C,D ) which are supposed to receive files from a network scanner. The scanner renders a PDF file named like this : ...
1
vote
1answer
21 views

Use xvfb to automate X program

I originally posted this question here, but upon second thoughts I decided here was a better place for this. I sadly have to use this proprietary program that bundles a camera driver. I want to ...
4
votes
2answers
188 views

shell script to make directories, subdirectories and files following a pattern

Is it possible to create a script that will create the following structure after running it: /test/1/1 -> A /test/1/2 -> B /test/1/3 -> C /test/1/4 -> D /test/1/5 -> E /test/1/6 -> ...
-4
votes
2answers
71 views

Create Directories and Subdirectories as Another User [closed]

I am trying to create directories and subdirectories as another user, from inside a shell script. The problem is, I am running the script as root, so the directory is being created with root ...
-1
votes
0answers
41 views

dump unstructured content of file to a csv or excel sheet [duplicate]

I believe it is not duplicate of other thread which we discussed in past. The reason being is: Here we have some rows (Virtual Disk, Physical Disk, device and shareddisk) which are repeating several ...
1
vote
1answer
42 views

script Multiple Commands

I have a PHP script I'm running from Cron. I want to save its output to file, but also want to save the shell output to a different file. Ideally, I'd like to have this in one line. As such, I tried ...
-2
votes
0answers
19 views

Mapping virtual drives in windows [closed]

Best was to map a virtual drive that will persist through reboot.. using a script or otherwise. Any help appreciated.
-1
votes
5answers
80 views

Bash script to insert letter based files into directories [closed]

I'll start by saying I'm a complete novice to this. So basically, what I need to do is create a script that makes 15 directories (named from 1 to 15) and inside each directory I have to have a letter ...
0
votes
2answers
37 views

Bash Script execute command as user

I'm just wondering if it's possible to execute a command inside a bash script as a specified user and supply the password in one string. At the moment I have COMMAND="${DIRECTORY}/script.sh" su -c ...
0
votes
2answers
43 views

Correct way to set PERMANENT environment variables from script

I want to do a very simple install process for my app framework. I've got everything working, but I want to set two environment variables. I want to update the PATH and also set a HOME variable. I ...
1
vote
2answers
30 views

Using getline with NR in awk

I have a bash script which calls a awk script to print each line from the file name_list.txt #!/bin/bash awk -f parse_list.awk name_list.txt In the awk script, I am using getline with NR to print ...
1
vote
2answers
49 views

How can I save password,when copy a file using SCP?

I am new in here. I am facing problem when I pull a file from another machine to my machine using SCP. File is successfully transferred but each time it asks for password. I want to run this SCP ...
3
votes
3answers
77 views

how to monitor a unix directory and if any new file in directory it will be copied to another directory

I want to monitor a unix(Solaris 10) directory and if there is any new file i want to copy immediately. Tried: I have shown inotifywait and incron package in linux for it but i don't know whether it ...
1
vote
1answer
46 views

How do I find files older than 1 days using mtime? [duplicate]

I'm trying to remove all files more than 1 days old.Before I execute a script to remove the files,I try to find the files using mtime. however, I face same problem with my command- My Current date is ...
3
votes
2answers
63 views

What does “if echo $line | grep -F = &>/dev/null” do?

I'm not sure what the following line does in a bash script: if echo $line | grep -F = &>/dev/null then ... I know &>/dev/null is short for >/dev/null 2>&1, I'm not sure, ...
0
votes
2answers
31 views

How to count how many files belong to each user/group combination?

How to count how many files belong to each user/group combination? I need to do this for each user/group combination that exists, in each of the directory trees /etc, /usr, and /var.
0
votes
1answer
11 views

linefeed in bash script - to email

I am doing printf to a logfile and having that logfile send through mailx, however, it seems that the linefeed "\n" are not recognised or captured in the mail. Snippet of script as below (notice the ...
0
votes
0answers
51 views

Shell scripts for proof reading

I am using below mentioned script present at link to check my writing. But, while running the scripts some syntax errors are shown up. I am not able to correct the same. Haroons-MacBook:democheck ...
0
votes
2answers
48 views

How can I filter out current directory ('.') in bash?

I'm currently trying to write a little script to convert all the flac files to mp3 files. However, I ran into a bit of a problem when trying to set up recursion down into all my music folders - the ...
-2
votes
2answers
52 views

How to use this script [closed]

#!\bin\bash for i in `seq 1 1000`; do wget -q -O quotes http://www.quotedb.com/quote/quote.php?action=random_quote; cat quotes>>final.txt; done I got this script from one website but I don't ...
0
votes
2answers
64 views

Script for ssh automatic login to a specific port

So currently, the "traditional" way to connect through SSH is the following one: ssh USERNAME@HOST -p PORT I would like to create a script in which I will include all the appropriate information ...
1
vote
0answers
34 views

Bold and Underline using echo with email

I am using a script that emails me a particular status report. The script sends me the contents of several files. I am using echo to provide a heading in the email that is used to differentiate ...
0
votes
0answers
10 views

LUA Script syntax

I wrote under suggestion a LUA script clearDS() addDS(".", "IN DNSKEY 257 3 8 ...
0
votes
2answers
46 views

How to execute a command on window focus/unfocus?

I'd like to execute xinput disable bcm5974 when Gnome Terminal (and maybe some other application) gets focused, and xinput enable bcm5974 when it loses focus. This is because libinput and my ...
1
vote
0answers
50 views

File exists but errors with “mv: cannot stat: No such file or directory”

For some reason my script cannot copy or move files that exist. It comes up with the errors below. Can someone tell me why? cp: cannot stat '/mnt/sd/bbu/install/scratch/bin/.': No such file or ...
1
vote
0answers
35 views

Setting environment variable using shell script

I am using csh scripts for some automation purpose. I have a number of scripts, and the beginning of all of which I need to set a fixed set of environment variables. |----SCRIPT 1---| |----SCRIPT ...
0
votes
0answers
17 views

script for user login/logoff timings everyday and delete the files which are older then 5 days

The below code is not running.  Can anyone please let me know the mistake? do-every-day.sh #create file & cpy the below contents lastlog -b 0 -t 1 > files.txt find files.txt -mtime ...
17
votes
6answers
998 views

How can I suppress output only if the command succeeds?

I would like to simplify the output of a script by suppressing the output of secondary commands that are usually successful. However, using -q on them hides the output when they occasionally fail, so ...
0
votes
0answers
39 views

Cronjob python script

I have a python script that parses some html and then writes it to output file. I want that cronjob would execute that python script. When I run this script from command line it works fine (python ...
0
votes
1answer
23 views

Sort words from n rows

i need to print all the unique words and their occurences from first n rows in a give file. I have to sorted by their number of occurences and then alphabetically.(the only separator is " ") ex: for ...
2
votes
0answers
32 views

Full screen terminal with script as screen saver under archLinux

Bonjour, Is it possible to run a terminal at full screen running a script instead of the screen saver ? That means that after 10 minutes of inactivity the screen should go black and show the STDOUT of ...
0
votes
2answers
40 views

Sort words in file

i've got some problems i'm not capable to overcome. I need to count the first let's say N words in a txt file. Then , i have to print them in decresing order, followed by the number of occurences.The ...
1
vote
2answers
29 views

How do I find a substring in a command line?

I have a few files that contains a similar entry like as follows: {"result":[]} {"result":[{"alternative":[{"transcript":"I ...
-1
votes
1answer
49 views

How to change shell from script

I want to change shell from ksh to bash and source the .kshrc file. I want to execute following lines of command sequentially: bash . ~/.kshrc clear Can anybody help me?
0
votes
1answer
15 views

Getting error while using httpd -v command in script

I wrote a script to check the details of Web server's(RHEL) and save the output into a file. But the script is not passing the command httpd -v in the loop. Here is the script. #!/bin/bash for i in ...
0
votes
1answer
28 views

get `top` output for non interactive shell

I want to implement top function for the web app, is it possible to get the output of top command in non interactive shell.
0
votes
0answers
19 views

Pantheon-Terminal open multiple tabs script

I'm new to linux so bear with me. I'm looking for a script that will open pantheon-terminal with 3 tabs, each with a certain location / commands. I have a basic script that when I run from the ...
1
vote
1answer
27 views

LFTP Script to Download Files

I want to write a lftp script that will download files every 15 minutes from a server every x amount of time. Can someone advise how i can do this? Thanks