Questions tagged [shell-scripting]

Programming in an Interpreted language executed by a running Shell

Generic programming in an Interpreted language (as opposed to compiled) executed by a running Shell. Sometimes referred to as "Glue Code" due to the practice of managing the execution and output of one or more compiled binaries and passing said output to another series of commands.

621 questions
1
vote
2 answers

Does it make sense to copy files in parallel to the same NFS mount?

Here's an example: ( cp /tmp/one /nfs/one ) & ( cp /tmp/two /nfs/two ) & ( cp /tmp/three /nfs/three ) & ( cp /tmp/four /nfs/four ) & ( cp /tmp/five /nfs/five ) & wait Against a busy NFS server, does doing this gain anything vs cp /tmp/one…
Justin
  • 141
  • 5
1
vote
1 answer

shell script + add inside the script PATH for standard output

Usually if we want to redirect script output to file we simply do /etc/create_connection.sh > file.debug.txt Or /etc/create_connection.sh | tee –a file.debug.txt But What I want is to add /etc/create_connection.sh > file.debug.txt …
Eytan
  • 611
  • 6
  • 13
  • 27
1
vote
1 answer

Bash: checking uniqueness of filenames, and renaming or removing files

I'm working in CentOS with bash and I have files in a directory as follows: 16948.png 16948_thumb.png 16948-1_thumb.png 16949.png 16948_thumb.png 16949-1_thumb.png 16950-1.png 16950-1_thumb.png 16950-2.png 16950-2_thumb.png I would like…
Richard
  • 25
  • 3
1
vote
3 answers

Shell script to start mysql server if not already running

I have a shell scipt and at some point I want to check if mysql is running and start it if it's not. I'm trying the following, but not having any luck: set mysqlstatus = `sudo /opt/local/bin/mysqladmin5 ping` if ["$mysqlstatus" != 'mysqld is…
1
vote
1 answer

What version of ksh ships with AIX 5.3?

I'm writing a Korn shell script for a client, who will use it on AIX 5.3. For testing, I'm using version 93u-1 Debian Wheezy. Is this the same version as the one I'll find on AIX?
Martin Geisler
  • 1,271
  • 9
  • 23
1
vote
3 answers

Shell Script for Sending output or log via email

I want to know if it is possible to get my backup script output or any of its errors via email using google (or any other SMTP server). I don't want to install a mail server on my local machine. What script or tool should I use to provide this…
user103373
  • 198
  • 6
  • 19
1
vote
3 answers

scp with password less authentication

scp with password less authentication is working fine but if delete a file on the source it will not get replicated ie the destination directory is not completely replaced with source. I can see the new files or modifications are properly get…
Aha
  • 409
  • 3
  • 8
  • 18
1
vote
3 answers

Copy all files to another location

I have a folder called "employee" and within that folder there are sub-folders with each employee name. employee >> amar >> akbar >> anthony Each of these folders contain 1 or 2 files. There are around 50 employees. I want to copy all those files…
shantanuo
  • 3,579
  • 8
  • 49
  • 66
1
vote
3 answers

Why is this bash script not working?

I'm making a bash script which checks the available space on disk: if [ check_space -gt "85" ]; then echo "removing" else echo "not removing" fi check_space returns a number like 52 and the check_space function is: check_space() { df /dev/sda1 |…
pmerino
  • 461
  • 2
  • 5
  • 11
1
vote
2 answers

How to find the IP address of the local Linux workstation

I am creating a shell script that should do some local settings and echo the IP of the machine in a text file. The reason I need to do this is to get the IP in a PHP script and use it from there as root for a site. I can get the IP using ifconfig…
zozo
  • 783
  • 3
  • 11
  • 22
1
vote
1 answer

(Ubuntu) How to configure startup application?

I'm trying to configure the startup application in Ubuntu. I want to perform the following tasks in sequence when a user login to Ubuntu's desktop: Ensure that the webserver is started automatically. After the webserver has been started,…
user014
  • 13
  • 2
1
vote
1 answer

PAM: How can I create a service which passes username/password to a script?

I'm setting up a PAM service for OpenVPN, such that the OpenVPN PAM module can authenticate a username/password to an external service that I will implement using a shell script. The OpenVPN PAM module states approximately the following…
davidparks21
  • 928
  • 1
  • 12
  • 27
1
vote
2 answers

Unix quota per user script

Is there any way to automate user's home folder qouta by script. I have auto useradd script, and I want to add code in script about quota for home folder of size 2 GB. For example: edquota sally Disk quotas for user sally (uid 1045): …
user77473
  • 41
  • 1
  • 3
1
vote
2 answers

How to iterate over a list of files and perform an action on them

I want to write a script (or preferably an alias) that does the following: Find all the files matching a pattern *.jar Iterate over all those files, and run jar tvf | grep Print if a jar contains a file with a name…
RonK
  • 241
  • 1
  • 5
  • 13
1
vote
2 answers

echo with each parameter on its own line

I would like an output similar to ls -1d, but I don't want to check if each file exists. I would prefer to just list the files. I could use echo, but echo only puts a space between files. How can I put a return between the files/parameters?
700 Software
  • 2,233
  • 10
  • 49
  • 77