Sponsored Content
Full Discussion: Portable shell script advise
Top Forums Shell Programming and Scripting Portable shell script advise Post 302972022 by MadeInGermany on Thursday 28th of April 2016 03:27:31 PM
Old 04-28-2016
No, because I tried to keep the functionality.
The $fmask simply allows to specify the "iS*" once at the beginning of the script. The shell will re-evaluate it every time.

But it is no big deal to replace the $fmask by $files for the scp and mv commands.
Then $fmask is evaluated once with the ls command, where the result goes to $files - and that is static.
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Can somebody advise any free Linux sever for shell programming?

Hi, everybody. I just wonder whether there are a couple of free Linux servers running as terminals where people can practice Unix Shell Programming? I'd like to set up one myself but unfortunatly can't do it. I can't switch to Linux now coz I run a couple of servers on my machine. Cygwin is... (3 Replies)
Discussion started by: belgampaul
3 Replies

2. Windows & DOS: Issues & Discussions

Portable GUI shell scripting?

I have some scripts that run in Windows, and the ability to put a GUI layer over them is kind of appealing. So when I stumbled over http://wizapp.sourceforge.net/ I thought that was rather cute. (Reading the "advanced batch scripting" art of the manual impresses upon me that no sane person... (2 Replies)
Discussion started by: luke
2 Replies

3. Shell Programming and Scripting

mail program on shell script didn't work, please advise.

Hi, everyone: I post a new thread because previous post may sink and I hope the new one can be caught by your eyes. I created a shell script and the script works fine. However, the mail program part on script didn't send email to my email box and it also didn't provide any traceable... (7 Replies)
Discussion started by: duke0001
7 Replies

4. Shell Programming and Scripting

Query regarding portable script

Dear Experts, I want to write a script which has to work on Solaris & Linux sytems. The problem which i am facing is, there are commands whose options are different on both OS's. For example ping. On Solaris i have to write: ping $host 1 to check if the host is alive On Linux i... (4 Replies)
Discussion started by: dhiraj4mann
4 Replies

5. Shell Programming and Scripting

advise some script to make the changes..!!

Hi Folks, got the solution..!! (5 Replies)
Discussion started by: tuntun
5 Replies

6. Shell Programming and Scripting

Solaris script using awk giving errors - please advise

I'm using solaris 10 Scenario as follows I have a logfile with 2 columns: column 1 = source directory + filename column 2 = destination directory + filename Using cron, my script polls for new files and adds them to the logfile ($ELOG) as described above. Using sed, the distination... (2 Replies)
Discussion started by: davidra
2 Replies

7. Shell Programming and Scripting

Portable Shell Script - Determine Which Version of Binary is Installed?

I currently have a shell script that utilizes the "Date" binary - this application is slightly different on OS X (BSD General Commmand) and Linux systems (gnu date). In particular, the version on OS X requires the following to get a date 14 days in the future "date -v+14d -u +%Y-%m-%d" where gnu... (1 Reply)
Discussion started by: colinjohnson
1 Replies

8. Shell Programming and Scripting

Optimizing the Shell Script [Expert Advise Needed]

I have prepared a shell script to find the duplicates based on the part of filename and retain latest. #!/bin/bash if ; then mkdir -p dup fi NOW=$(date +"%F-%H:%M:%S") LOGFILE="purge_duplicate_log-$NOW.log" LOGTIME=`date "+%Y-%m-%d %H:%M:%S"` echo... (6 Replies)
Discussion started by: gold2k8
6 Replies

9. Shell Programming and Scripting

Tip: template for a safe and portable script

In an attempt to finally end this article I start this new thread. Here is a template for a safe and portable script. #!/bin/bash # /bin/bash exists on most still supported Unixes # # tr and date behave better with if ; then export LC_ALL=C; else export LANG=C; fi # # Unix optional packages... (2 Replies)
Discussion started by: MadeInGermany
2 Replies
pmount(1)						      General Commands Manual							 pmount(1)

NAME
pmount - mount arbitrary hotpluggable devices as normal user SYNOPSIS
pmount [ options ] device pmount [ options ] device label pmount --lock [ options ] device pid pmount --unlock [ options ] device pid pmount DESCRIPTION
pmount ("policy mount") is a wrapper around the standard mount program which permits normal users to mount removable devices without a matching /etc/fstab entry. pmount also supports encrypted devices which use dm-crypt and have LUKS metadata. If a LUKS-capable cryptsetup is installed, pmount will use it to decrypt the device first and mount the mapped unencrypted device instead. pmount is invoked like this: pmount device [ label ] This will mount device to a directory below /media if policy is met (see below). If label is given, the mount point will be /media/label, otherwise it will be /media/device. The device will be mounted with the following flags: async,atime,nodev,noexec,noauto,nosuid,user,rw Some applications like CD burners modify a raw device which must not be mounted while the burning process is in progress. To prevent auto- matic mounting, pmount offers a locking mechanism: pmount --lock device pid will prevent the pmounting of device until it is unlocked again using pmount --unlock device pid. The process id pid assigns the lock to a particular process; this allows to lock a device by several pro- cesses. During mount, the list of locks is cleaned, i. e. all locks whose associated process does not exist any more are removed. This prevents forgotten indefinite locks from crashed programs. Running pmount without arguments prints the list of mounted removable devices, a bit in the fashion of mount (1). Please note that you can use labels and uuids as described in fstab (5) for devices present in /etc/fstab. In this case, the device name need to match exactly the corresponding entry in /etc/fstab, including the LABEL= or UUID= part. Important note for Debian: The permission to execute pmount is restricted to members of the system group plugdev. Please add all desktop users who shall be able to use pmount to this group by executing adduser user plugdev (as root). POLICY
The mount will succeed if all of the following conditions are met: o device is a block device in /dev/ o device is not in /etc/fstab (if it is, pmount executes mount device as the calling user to handle this transparently). See below for more details. o device is not already mounted according to /etc/mtab and /proc/mounts o if the mount point already exists, there is no device already mounted at it and the directory is empty o device is removable (USB, FireWire, or MMC device, or /sys/block/drive/removable is 1) or whitelisted in /etc/pmount.allow. o device is not locked OPTIONS
-r, --read-only Force the device to be mounted read only. If neither -r nor -w is specified, the kernel will choose an appropriate default. -w, --read-write Force the device to be mounted read/write. If neither -r nor -w is specified, the kernel will choose an appropriate default. -s, --sync Mount the device with the sync option, i. e. without write caching. Default is async (write-back). With this option, write opera- tions are much slower and due to the massive increase of updates of inode/FAT structures, flash devices may suffer heavily if you write large files. This option is intended to make it safe to just rip out USB drives without proper unmounting. -A, --noatime Mount the device with the noatime option. Default is atime. -e, --exec Mount the device with the exec option. Default is noexec. -t filesystem, --type filesystem Mount as specified file system type. The file system type is automatically determined if this option is not given. See at the bottom for a list of currently supported filesystems. -c charset, --charset charset Use given I/O character set (default: utf8 if called in an UTF-8 locale, otherwise mount default). This corresponds with the mount option iocharset (or nls for NTFS). This option is ignored for file systems that do not support setting the character set (see mount (8) for details). Important note: pmount will now mount VFAT filesystems with iocharset=iso8859-1 as iocharset=utf8 currently makes the filesystem case-sensitive (which is pretty bad...). -u umask, --umask umask Use specified umask instead of the default one. For UDF, the default is '000', for VFAT and NTFS the default is '077'. This value is ignored for file systems which do not support setting an umask. Note that you can use a value of 077 to forbid anyone else to read/write the files, 027 to allow your group to read the files and 022 to allow anyone to read the files (but only you can write). --dmask dmask --fmask fmask Some filesystems (essentially VFAT and HFS) supports separate umasks (see the -u option just above) for directories and files, to avoid the annoying effect of having all files executable. For these filesystems, you can specify separately the masks using these options. By default, fmask is umask without all executable permissions and dmask is umask. Most of the times, these settings should just do what you want, so there should be seldom any need for using directly the --fmask and --dmask options. -p file --passphrase file If the device is encrypted (dm-crypt with LUKS metadata), read the passphrase from specified file instead of prompting at the termi- nal. -h, --help Print a help message and exit successfully. -d, --debug Enable verbose debug messages. -V, --version Print the current version number and exit successfully. FILES
/etc/pmount.allow List of devices (one device per line) which are additionally permitted for pmounting. Globs, such as /dev/sda[123] are permitted. See see glob (7) for a more complete syntax. SEE ALSO
pumount(1), mount(8) SUPPORTED FILESYSTEMS
For now, pmount supports the following filesystems: udf, iso9660, vfat, ntfs, hfsplus, hfs, ext3, ext2, ext4, reiserfs, reiser4, xfs, jfs and omfs. They are tried sequentially in that exact order when the filesystem is not specified. Additionally, pmount supports the filesystem types ntfs-fuse and ntfs-3g to mount NTFS volumes respectively with ntfsmount (1) or ntfs-3g (1). If the file /sbin/mount.ntfs-3g is found, then pmount will mount NTFS filestystems with type ntfs-3g rather than plain ntfs. To dis- able this behavior, just specify -t ntfs on the command-line, as this happens only for autodetection. MORE ABOUT FSTAB
pmount now fully resolve all symlinks both in its input and in the /etc/fstab file, which means that if /dev/cdrom is a symlink to /dev/hdc and you try to mount /dev/hdc directly, pmount will delegate this to mount(1). This is a feature, and it contrasts with previous unclear behavior of pmount about symlinks in /etc/fstab. KNOWN ISSUES
Though we believe pmount is pretty much free from security problems, there are quite a few glitches that probably will never be fixed. o pmount needs to try several different times to mount to get the filesystem right in the end; it is vital that pmount does know which pre- cise filesystem to mount in order to give it the right options not to cause security holes. This is rather different from the behaviour of mount with the -t auto options, which can have a look at the device it is trying to mount and find out what its filesystem is. pmount will never try to open a device and look at it to find out which filesystem it is, as it might open quite a few security holes. More- over, the order in which the filesystems are tried are what we could call the most commonly used filesystems on removable media. This order is unlikely to change as well. In particular, that means that when you mount an ext3 filesystem using pmount, you might get a lot of fs-related kernel error messages. Sorry ! NOTE: Starting from version 0.9.17, pmount uses the same mechanism as mount (1) to autodetect the filesystem type, so this kind of problems should not happen anymore. AUTHOR
pmount was originally developed by Martin Pitt <martin.pitt@canonical.com>. It is now maintained by Vincent Fourmond <four- mond@debian.org>. Martin Pitt August 27, 2004 pmount(1)
All times are GMT -4. The time now is 10:05 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy