1
vote
1answer
32 views

How to create your own commands that can be used anywhere [duplicate]

I am new to linux, and I am learning bash scripting at the moment. I was wondering how I would save my script as a command and then be able to call that command anywhere in the terminal. So i could ...
1
vote
3answers
51 views

How to get list of all non-removable disk device names (SSD/HDD and SATA/IDE only)?

I need a list of all disk device names (not USB or CD ROM) in the following form DRIVES='sda sdb' so that I can loop through them in a bash script. Ideal solution would not have to install a special ...
0
votes
1answer
38 views

Run some shell files from another shell file in different location

I have 5 shell files in a specific locations on my ubuntu system. I have two users on this system userA which is the main user and userB. Currently I have to manually open a terminal using user userA ...
2
votes
1answer
125 views

Stopping a running script though another script file

I am new to shell scripts. Say, I start a script like this. This runs for 3 days. So, I will start the script remotely through ssh and then close my local terminal. start.sh end=$((SECONDS+259200)) ...
0
votes
0answers
12 views

SOHO Network Scripts

I have a trying to develop two simple scripts to automate the set up of a small office with a Ubuntu server and workstations. I am likely in way over my head, but I am trying to do it anyways. The ...
0
votes
2answers
35 views

End script and restart it with the same options and arguments

Usually !! repeats the last given command. But it doesn’t seem to work in a bash script. Is there a way to end a script and repeat it with the exact same options and arguments given the last time? ...
2
votes
2answers
87 views

.sh file on Startup Applications isn't executed

This is a followup to a question about dialog boxes. I want to show a dialog box both at the start of a session, and after n minutes of inactivity. I have decided to use zenity and xautolock. I have ...
1
vote
2answers
40 views

Do higher level scripting languages use shell scripts to work?

I'm just learning about bash and when I saw that bash uses 'echo' I tried to search for the relationship between PHP and bash and it seems like people are building programs were bash script and PHP ...
2
votes
1answer
50 views

script in bash not understood using terminal in Ubuntu 12.04 [closed]

Can anyone tells me what does this script means found in a .sh file:: [ ! -n "$T_R" ] && echo "Message Appear" && exit 1;
0
votes
1answer
62 views

Shell script exits without evaluating if condition

I have the following commands in my shell script #This line basically builds a source library $BUILD_CMD $CONFIGFILES/$1.prj $BUILDFILESPATH if [ $? -eq 0 ];then echo "Build success\n" #do ...
1
vote
2answers
77 views

Automating rsync commands

I currently have too many rsync commands that I run on a day to day basis. Could someone be kind enough to let me know how I can automate these commands? I am new to Linux so a little bit of ...
0
votes
1answer
61 views

return value from awk

This is mybashfile.sh file . . . awk -f myawkfile.awk mytracefile.tr . . . Now I want to return one parameter from myawkfile.awk to the current mybashfile.sh. Is there any way to return a value ...
28
votes
3answers
1k views

Should I save my scripts with the .sh extension?

I have some functional scripts and I want to copy to /usr/bin I want to use them as normal terminal commands. Is it a good practice to use them with the .sh extension or can I save them without ...
0
votes
1answer
117 views

Can't install HoNClient-3.4.3.sh

I'm desktop user. My OS running 32-bit Ubuntu 14.04LTS. The problem I've run into is this: When I try to run the client in the terminal, using the command: sudo sh HoNClient-3.4.3.sh it gives me ...
0
votes
1answer
98 views

Unigine Heaven run directly from terminal?

I think a lot of you would have benchmarked your Linux system using Unigine Heaven Benchmark 4.0. I know to run the it you can simply go to the Unigine Heaven folder and run the shell script file ...
1
vote
1answer
88 views

Run the script file after 5 or 10 min after restarting the system

I have created a ruby script file that checks the connection present or not. For example checking port 22 is opened or not. Firstly I tried with cron job as follows @reboot find ...
23
votes
3answers
2k views

Where should I put my script so that I can run it by a direct command?

Where can (should) I put my (bash) script so that it can be used (forever) by terminal or by a direct command: Alt+F2? I know there is /usr/bin and /sbin & /bindirectories but when should I use ...
0
votes
1answer
38 views

Shell script backup routers

Below is a script I've wrote to backup my routers and adsl modem, Any ideas to compact this script in less lines? Each router have a different kind of structure as you can see. #!/bin/sh ...
1
vote
1answer
456 views

Bash script doesn't execute command from PATH

I have this simple script: #!/bin/bash echo ${HADOOP_HOME} $(hadoop fs -ls) The output is: /opt/hadoop-0.20.2-cdh3u2 ./hello.sh: line 3: Found: command not found So bash definitely sees ...
4
votes
3answers
142 views

How to check the number of fields given to the `read` command?

I have a quick question relating to $# in the shell scripts. So, I can use $# at the command line to check the number of a shell script arguments given by the user. Example: # ./shellScript varONE ...
3
votes
1answer
450 views

pkill not killing

I have a Script named PirateRadio.py That I am writing a script for. I need to kill and reload the script. Possibly with the same PID. I thought SIGHUP was a sure thing. when i run #pkill -1 ...
3
votes
1answer
107 views

How can “git gui” open repository from parent directory?

I start Git GUI tool using command git gui or git citool. I wanted to add another entry to right click script menu (already have dozens of commands) and created a script like this: #!/bin/sh git ...
4
votes
2answers
260 views

How do I iterate the arguments in a bash script?

Is there any method to iterate the passed arguments in a bash script? This answer from my question shows me how to use each argument, but I want to iterate them because the number of arguments is ...
3
votes
1answer
608 views

How to check in a bash script if passed argument is file or directory?

I have to write a simple bash script in Ubuntu which would allow me to pass it some arguments and I want to check if these arguments which can contain spaces are files or directories. How can I do ...
1
vote
1answer
106 views

How to see if there are any qbittorent torrents from shell script?

I run a script on startup that opens a browser, irc, and qbittorrent. It looks similar to this: chromium-browser & qbittorrent & xchat & guake & Is there any way I can detect if ...
0
votes
0answers
22 views

Startup script for pxeboot

I am working on pxeboot. Now i want to do startup script in pxeboot server and whenever client started the startup script will run on the client machine. How to do that. ?
3
votes
3answers
311 views

How to concate strings in a bash script to use in SQL-Statement? [closed]

I would like to do the following in a bash script: read some filenames out of an file with filenames set a variable input path concat 1. and 2. use 3. in sql-statement Here my code: ...
0
votes
1answer
522 views

Creating and executing shell scripts to run XAMPP on double click [duplicate]

Basic Specs - Ubuntu 13.10, Gnome 3 (session fallback), Ambiance theme, Faenza icons. I recently installed XAMPP, now everytime i want to use the program i have to run the sudo /opt/lampp/lampp start ...
2
votes
1answer
315 views

Yad list columns

I need some help with Yad. This is my code: contact=$(while read line do firstname=$(echo $line | awk 'BEGIN { FS="|" } { print $2 }') lastname=$(echo ...
0
votes
0answers
45 views

Need a shell script to loop launching a connection to a thin client, waiting, logging off, then connecting to a windows 7vm

I'm very new to Ubuntu and I need to have a shell script to do what the title says. I used: xfreerdp -u [uname] -p [password] -o --plugin drdynvc --data rdpeusb -g 1280x1024 -- [vm's ip] to make ...
0
votes
2answers
327 views

how do I use upstart, instead of cron, to start a single instance of a job which should always respawn?

How do I script the following bitcoin/dogecoin/etc cpuminer command: /home/digger/cpuminer/minerd -o stratum+tcp://doge.pool.webxass.de:3333 -O <user>.<worker>:<worker_password> ...
0
votes
2answers
2k views

cron error: bad username

I've basically re-written the terminal output instead of appending a series of edits to this question: root@doge:/etc/cron.d# root@doge:/etc/cron.d# tail /var/log/syslog Dec 21 11:35:01 doge ...
1
vote
1answer
81 views

Running a script at shutdown

I've read the answers to this and similar questions already, but so far none had worked for me. On my Ubuntu 11.10 (oneiric) system, all the files in /etc/rc0.d/ and /etc/rc0.d/ are links. I put ...
0
votes
1answer
186 views

sending email if disk space exceeds

I have a script to calculate available disk space and alert by email if the limit exceeds a given value defined by me. Here is the script: df -H | grep -vE '^Filesystem|tmpfs|cdrom' | awk '{ print $5 ...
0
votes
2answers
50 views

when to use -f or -a tag in if loop

I'm confused between two tages that can be used in if statement in bash scripting. One is -f and other is -a. Their description states as follows: [ -f FILE ] True if FILE exists and is a regular ...
5
votes
3answers
390 views

Convey some message to all users

Is it possible to write a shell script that enables any user (may not be root) to set a message(e.g. "Download on progress do not turn off" etc.) which will be conveyed like pop-up message (zenity or ...
0
votes
0answers
16 views

How to run a script automatically if there is any specific hardware is detected [duplicate]

I want to run a script automatically when a headset was inserted on its corresponding jack and a USB modem was inserted on its corresponding ports. Any help will be appreciated!
0
votes
1answer
510 views

Select (loop) or command not working in shell-script [duplicate]

I've been tinkering with Linux and Unix for years but still a novice in my mind and recently find myself trying to be more pro with it as I work in IT. So with that notion I'm studying shell ...
0
votes
1answer
51 views

Unmount script running on unmounted device

How can I unmount a USB drive using a script located on that drive? The device appears busy when the script is running,
0
votes
1answer
173 views

Cant create a file and write to it from a .sh script

I am trying to create a file and write to it using a .sh script but is not working(Nothing is being created, and I don't see any error). This is how that part of my script looks like: ...
1
vote
1answer
91 views

I can't rename a file using the terminal if it came from a parameter

I am automating some deployment task with an .sh script but at some point I need to rename a file but it is not working. The file change can be different but the postfix is the same. Let's have a look ...
1
vote
1answer
439 views

Shell Script Unable to send execution time via email

I wrote a shell script which calculates the execution time of itself but the problem I'm facing is its not able to send the time difference via email. Please Help. Here is the Script #!/bin/bash ...
0
votes
3answers
257 views

How to insert characters after every line in a file?

I want to create a script that insert 20 characters following each line in a text file. Suppose the file contains the following lines: text.... text.... text... I want to obtain: text.... ...
2
votes
1answer
3k views

Malware and Backdoor detection Shell Script

I'm trying to build a shell script which can automatically detect malware, backdoors and rootkits and I'm trying to research for it. I found some of the things like find . -name “*.js” | xargs grep ...
0
votes
1answer
79 views

Unrar: Resulting files vanishing

Ok, so I have a directory which contains a whole load of folders containing RAR files, which I'd like to use a script to recursively unrar. The script I have seems to work (extracting the resulting ...
0
votes
3answers
252 views

Error running a script: ?#!/bin/csh: No such file or directory

I am trying to run the following script which will start a simulation run with a climate simulation program: #!/bin/csh # run-script generated by Most Tue Jul 23 13:10:46 2013 set EXP=MOST # Name ...
0
votes
1answer
355 views

sendmail gives empty recipients in email

Im using a script that takes backup and sends status email using sendmail but the emails its sending comes with the to tag empty here is an image of it Here is the part of the script #Email ...
0
votes
1answer
1k views

Script to email files content

I have created a shell script that takes backups everyday and emails its execution as successfull or unsuccessfull. Now I want that it send the contents of log file it creates with the mail as well. I ...
1
vote
2answers
948 views

script to compress multiple files

I have a script that generates backup and finds files older than 30 days and compresses them. Now the problem I'm facing is if the files are more than one than how can I edit the script so that it ...
1
vote
2answers
289 views

Shell Script to block Ip addresses

Is it possible to write a shell script that checks connections in an apache server and blocks suspicious ip addresses with large number of connections automatically and fires a mail for it to the ...