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
2answers
51 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
52 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
37 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 ...
18
votes
6answers
1k 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
25 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
39 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
42 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
32 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
50 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
16 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
30 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
20 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
31 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
1
vote
2answers
42 views

How can I run this python script on all html files under a directory? [duplicate]

I have a python script $ cat ~/script.py import sys from lxml import etree from lxml.html import parse doc = parse(sys.argv[1]) title = doc.find('//title') title.text = span2.text.strip() print ...
0
votes
1answer
23 views

regarding recursive deleting of a specific file type

I wanted to delete a specific file type say *.bak file from any directory and its subdirectories. I used the following command to find the files. find <path> -name "*.bak" -type f However, ...
0
votes
1answer
22 views

Finding files that have been modified using a script?

I need to find files in a given directory that have been modified in the last N days, where N is the second argument of the script. Basically, I need to give the command with 2 numbers (arguments) and ...
1
vote
2answers
38 views

Script to Organize Desktop into Folders/Directories by Extension

I'd like to organize desktops by running a script that places all of your files into folders by extension. I found some code through googling and the code I found creates a folder with the name of the ...
-4
votes
1answer
34 views

find problems again? [closed]

How do i show pipe or socked files from a directory? echo "give name of directory: " read directory if [ -d "$directory" ] then echo "thanks again" else exit fi find $directory -maxdepth 1 -type ...
0
votes
0answers
26 views

Creating a mini text-editing program

I often copy-paste text from pdfs into other applications, and wish there was an easy offline way of editing the text's characteristics. For example, this website removes line breaks, while this ...
-2
votes
2answers
82 views

How do you remove newline character in the middle of file?

File structure: Col1|Col2|Col3|Col4 123|456|abcdefg Tel.: 689346589934, xyz lckhasfkl|abc I want to remove the newline character from 'col3' only.Please suggest
2
votes
1answer
47 views

Regular Expression to match (not x) and y (!x & y)

I received a desktop day-to-day calendar with puzzles. One such puzzle was deciphering a quote where the letters were substituted with symbols. I used some RegExs to find longer words, then used the ...
0
votes
2answers
46 views

How to delete a line with a given word using SED function

I have a file .txt with inside ID VALUE test value_1 testing value_2 first value_3 second value_4 I'm trying to write a shell script which will delete a line corresponding to a ...
4
votes
2answers
132 views

How do I sync files between two drives?

What command can check that a directory contains the same files as another directory, all the files are up to date and copy any updated files or new files to the first directory. It should not care ...
0
votes
2answers
42 views

how to write python code to change display color

I want to change display color. I have a simple script: #!/bin/bash sleep 50 xrandr --output VGA1 --gamma 1.28:1:1.28 # for purple How can I write it in python?
2
votes
1answer
38 views

Run executable with variable in Bash

I have the following simple script to run an executable: ./executable.x -input input.dat << i input1 input2 i This works perfectly and all is right with the world. However, I would like to ...
3
votes
1answer
34 views

Allow only wrapper script but not command

Say one has a resource hungry command that users on a server need to run. I want to wrap said command with a wrapper script that will parse the arguments passed and ensure that the command is only ...
1
vote
1answer
22 views

mpack description (-d) from a script variable

In my script I have a variable named $message. I want to send this message together with a jpeg using mpack. One way that works: echo "$message" > myText mpack -s "test mail" -d myText ...
-1
votes
1answer
39 views

awk getline to display first three lines in file

I'm using awk 'BEGIN {while((getline gf < "awk.script") > 0) {print gf}}' to read me first 3 three lines of the pattern. I can do with head -3 . But I don't want to since, I have to switch ...
1
vote
2answers
40 views

Storing application passwords in central location

Is there any secure local service that one should use for storing and retrieving organization wide application passwords? Most of the time we need authentication information in our scripts to run some ...
3
votes
1answer
67 views

Split line to words of maximum size of 8 characters

I'm creating script that will display 2 times the song name in FM radio station name. Radio station name is limited to 8 characters. Lets say I have this line: Best Direction - I feel good The code ...
-1
votes
1answer
25 views

Comparing values in one same string [closed]

In my script, Im getting data from website, like that: content=$(wget 10.0.1.5:8000/currentsong?sid=1 -q -O -); It's basicaly song information on shoutcast server. But there is the problem: I like ...
0
votes
1answer
23 views

tftp non-intearctive mode not working

tftp inline not working root@kali:~/scripts/recon_enum/exploit-db# tftp -v 192.xxx.xx.xxx 69 -c get text.txt text.txt usage: tftp host-name [port] tftp> but its working in interactive mode: ...
0
votes
2answers
32 views

Writing a bash script on a new box, Escaping Code [duplicate]

There may be a question out there for this somewhere. But I wasn't able to find it easily. Basically I want to write a bash script on a new box. A script that I've previously used. Example: ...
4
votes
2answers
49 views

Redirecting bash loop output to variable specific files

this should probably be obvious to me, but I've been stuck for some time. I'm trying to write a very simple bash loop to take a list of servers, retrieve some specific info from them, and save the ...
0
votes
1answer
40 views

Measuring how much batteries lasts on another system? [closed]

I have both a Linux computer and Microsoft Vista laptop. I would like to know how much the batteries last on the laptop from the computer. How can I do a script for that, i.e. how to check on Linux ...
1
vote
1answer
25 views

Evenly allocate resources over multiple desinations

I'm not quite familiar enough with bash to figure this out properly, I'll try to be brief with what I'm trying to figure out! I have many paths stored in a file, along with their size (in G), such ...
2
votes
1answer
65 views

bash: if / elif / fi gets not evaluated properly

I've got a script which checks for a specific PNG file in three directories. The first one is local and gets checked first. The second one is a remote share and gets checked only if the file is not ...
0
votes
1answer
39 views

Script for renaming files using text file containing alternate file names

I have a folder containing thousands of files: file1.jpeg file2.jpeg file3.jpeg etc. I have a text file containing a list of new filenames I want to substitute: old_filename new_filename ...
1
vote
0answers
66 views

killall doesn't work if I call it from a script

I'm starting a tcpdump inside a script and I also kill it from the same script. So I'm currently using the killall command for this: The script gets executed from an udev rule: This is the section, ...
1
vote
1answer
21 views

Replace .vmdk for VirtualBox in bash?

So I have a external SATA adapter and a VirtualBox Windows 10 VM. I regularly swap in and out hdds that I want the VM to be able to access. Now I can create the vmdk with no issue with VBoxManage ...
0
votes
1answer
51 views

Runlevel script

I want to make a simple script so that the user can easy change the runlevels. The script should prompt the user to choose the new runlevel, run the /sbin/init program and receive a confirmation ...
0
votes
2answers
42 views

Remove both lines if column A values are repeated in next row

My input is like this: pak_c35079_g1_i1|m.14890 Pfam pak_c20797_g1_i1|m.3458 ProDom pak_c20797_g1_i1|m.3458 Pfam pak_c28265_g1_i3|m.9595 TIGRFAM pak_c28265_g1_i3|m.9595 ...
1
vote
1answer
16 views

Rename files to insert _ between StudlyCapsified words

I've a music lib where files names are like 05WithoutWallsSpanishMixChillDeLucia.mp3 (no space between words BUT exist a capital letter at beginning of every word). How do I detect this string form ...
3
votes
3answers
19 views

jump to current day's directory in a date based directory hierachy?

I have a pretty standard directory higherachy, year, month, date, for log files. If I want to go to todays logs I have to type cd logs/2015/12/16/ By itself this wouldn't be bad, but since I ...
2
votes
2answers
43 views

Check Input Prior to Executing a “for loop”

is there any way to check or test the input from a 'read' against a for 'loop'? I don't want the case statement to execute there any of the input is incorrect. As of right now it will loop through, ...
-1
votes
1answer
35 views

Trying to sum a decimal column from a csv file for each different vendor

I am new to Unix/Linux and am trying to sum a column for each vendor in a loop. I apologize for the vagueness. I will try to explain. It is suppose to read from a file and based on the vendor name ...
3
votes
2answers
57 views

Changing file permissions according to their names

I created 512 files, with names made from combinations of permisions (r, w, x). I created them like this: touch ./{r,-}{w,-}{x,-}{r,-}{w,-}{x,-}{r,-}{w,-}{x,-} and I want the files to have same ...
1
vote
1answer
21 views

How to put the percentage of use of each core from cpu

I use the Zabbix Server to monitor my environment. The metrics used by Zabbix to view the CPU are too confusing, so I would like to simplify. Is there a way to get the percentage of use of each core ...