06-06-2008
When I run this, I am getting the below error. Why? Pls help me
#!/bin/ksh
echo Hello World
dirs="not_using_0"
for entry in *; do
[ -d "$entry" ] && dirs="$dirs $entry"
done
dirarray=($dirs)
index=1
while [ -n "${dirarray[$index]}" ] ; do
echo "${index}: ${dirarray[$index]}"
index=`expr $index + 1`
done
while [ -z "$ans" ] ; do
echo -n "Choose one -> "
read ans
[ -z "${dirarray[$ans]}" ] && echo "Invalid response; try again."
done
echo "Result is ${dirarray[$ans]}"
Hello World
arrayshell.sh: syntax error at line 7: `dirarray=' unexpected
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
I want to pull out the 3rd column of information and stick in a file. What is the Utility I use to do this? (8 Replies)
Discussion started by: James
8 Replies
2. Programming
I wrote a makefile, every thing is working fine,
But One of the C header files which is created by me is kept in a different folder other than the current directory,
I have given this PATH to VPATH Variable
Example :- VPATH = /home/user1/projects/victor.h
It gives an error as : file... (4 Replies)
Discussion started by: victorvvk
4 Replies
3. Shell Programming and Scripting
Hi All,
Is there any utility or command to read a .gz file without GUNZIPing it?
Why I need this because of the huge size of the file. I am looking for something like zcat. Any help is aprreciated.
Thanks in Advance..
Regards,
rin... (1 Reply)
Discussion started by: rinku11
1 Replies
4. Shell Programming and Scripting
Hi all,
I am parsing command line options using getopts.
The problem is that mandatory argument options following ":" is taking next option as argument if it is not followed by any argument.
Below is the script:
while getopts :hd:t:s:l:p:f: opt
do
case "$opt" in
-h|-\?)... (2 Replies)
Discussion started by: gurukottur
2 Replies
5. Shell Programming and Scripting
hi experts,
Can you please help me out in removing delimiters with in double quotes from a CSV file.
input:
=====
a,"bnn,",dgd, "sagfh,dj",ad
output
=====
a,"bnn",dgd, "sagfhdj",ad
there are so mnay fileds in a row and there are millions of rows.
Thanks in an advance.... (6 Replies)
Discussion started by: subhendu81
6 Replies
6. Shell Programming and Scripting
Hi,
I need to zip/compress a data file and send to a vendor. The vendor does have only unzip utility and can accept only .ZIP files. I do not have zip utility in my server.
How do I zip/compress the file so that it can be deflated using unzip command ? I tried gzip & compress commands, but... (1 Reply)
Discussion started by: Sabari Nath S
1 Replies
7. Shell Programming and Scripting
To find all the files in your home directory that have been edited in some way since the last tar file, use this command:
find . -newer backup.tar.gz
Is anyone familiar with an older solution?
looking to identify files older then 15mins across several directories.
thanks,
manny (2 Replies)
Discussion started by: mr_manny
2 Replies
8. Shell Programming and Scripting
Hi Expert,
I would like to know on how to export only the first 6 character of below
0050569868B7
ABCDEFGHTY
to
005056
ABCDEF
Thank you.
Reggy (7 Replies)
Discussion started by: regmaster
7 Replies
9. Shell Programming and Scripting
Hi,
I have a command in my bash script, searchDirectoryName.sh:
DIR_NAME=$(find . -type d)
echo "${DIR_NAME}"
.
./Dir1
./Dir1/1.0.2.1
./Dir2
./Dir2/1.1
./Dir3
./Dir3/2.2.1
How can I select only following directory names with second subdirectoies and without first ./ in the... (3 Replies)
Discussion started by: hce
3 Replies
10. Solaris
Hi,
I installed some packages required by an app built with python.
But when I try python setup.py install, I get the following error:
/opt/csw/lib/gcc/sparc-sun-solaris2.10/5.2.0/../../../../sparc-sun-solaris2.10/bin/as: unrecognized option `-m32'
Could anyone tell me what's wrong... (4 Replies)
Discussion started by: Kimkun
4 Replies
LEARN ABOUT OPENSOLARIS
xdg-user-dirs-gtk-update
xdg-user-dirs-gtk-update(1) User Commands xdg-user-dirs-gtk-update(1)
NAME
xdg-user-dirs-gtk-update - Graphical User Interface for xdg-user-dirs-update.
SYNOPSIS
xdg-user-dirs-gtk-update
DESCRIPTION
xdg-user-dirs-gtk-update is automatically run on login to the GNOME desktop environment to aid in the management of the locale specific XDG
User Directories.
Should the user be starting a session that is using a different locale to that which was used to create the original XDG User Directories,
then the user will be prompted to make a decision on whether to update the XDG User Directories to the new locale or leave them unchanged.
The original locale that was used to create the initial set of XDG User Directories on first login is stored in the file ${XDG_CON-
FIG_HOME}/user-dirs.locale.
Should the user decide to update to the current locale, then xdg-user-dirs-update will be used to perform the desired action.
ENVIRONMENT VARIABLES
See environ(5) for descriptions of the following environment variables:
HOME.
Other environment variable that are used are:
XDG_CONFIG_HOME
Base directory for storge of XDG configuration files. Defaults to ${HOME}/.config
FILES
The following files are used by this application:
/usr/bin/xdg-user-dirs-gtk-update
Application to manage updates to user's XDG User Directories
${XDG_CONFIG_HOME}/user-dirs.locale
Locale used in the initial creation of the current XDG User Directories and what they map to.
${XDG_CONFIG_HOME}/user-dirs.dirs
Location of the user-specific configuration including the current list of directories and what they map to.
ATTRIBUTES
See attributes(5) for descriptions of the following attributes:
+-----------------------------+-----------------------------+
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
+-----------------------------+-----------------------------+
|Availability |SUNWxdg-user-dirs-gtk |
+-----------------------------+-----------------------------+
|Interface stability |Uncommitted |
+-----------------------------+-----------------------------+
SEE ALSO
More information can be found at:
http://www.freedesktop.org/wiki/Software/xdg-user-dirs
xdg-user-dirs-update(1), xdg-user-dir(1), attributes(5)
NOTES
Written by Darren Kenny, Sun Microsystems Inc, 2008
SunOS 5.11 03 Apr 2008 xdg-user-dirs-gtk-update(1)