<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Looking for a modified copy command [ Prefrably a C shell Script] in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/looking-for-a-modified-copy-command-prefrably-a-c-shell-script/m-p/4363354#M668307</link>
    <description>James&lt;BR /&gt;Thanks for your prompt reply. My objective is to have an "Archive" directory wherever the file is being backed up which I understand maybe a little complicated.&lt;BR /&gt;Howevery I am getting a syntax error as below.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;surya{root}50% ./mycp /etc/resolv.conf&lt;BR /&gt;./mycp: syntax error at line 7: `SUBDIR=${ARCHIVE}/$' unexpected&lt;BR /&gt;surya{root}51% &lt;BR /&gt;</description>
    <pubDate>Fri, 20 Feb 2009 21:51:40 GMT</pubDate>
    <dc:creator>Shreeraj Karulkar</dc:creator>
    <dc:date>2009-02-20T21:51:40Z</dc:date>
    <item>
      <title>Looking for a modified copy command [ Prefrably a C shell Script]</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/looking-for-a-modified-copy-command-prefrably-a-c-shell-script/m-p/4363352#M668305</link>
      <description>As a sysadmin I often find myself backingup files before changing them with something like&lt;BR /&gt;&lt;BR /&gt;% cp -p filename filename.backup&lt;BR /&gt;&lt;BR /&gt;I am looking for something which copies a individual file in a directory (probably called "Archive") in the same place. It should create a directory if one does not exist.&lt;BR /&gt;&lt;BR /&gt;example: &lt;BR /&gt;&lt;BR /&gt;% mycp /etc/resolv.conf &lt;BR /&gt;&lt;BR /&gt;should make a copy of the file "/etc/resolv.conf" as &lt;BR /&gt;&lt;BR /&gt;/etc/Archive/resolv.conf.backup&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 20 Feb 2009 19:45:05 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/looking-for-a-modified-copy-command-prefrably-a-c-shell-script/m-p/4363352#M668305</guid>
      <dc:creator>Shreeraj Karulkar</dc:creator>
      <dc:date>2009-02-20T19:45:05Z</dc:date>
    </item>
    <item>
      <title>Re: Looking for a modified copy command [ Prefrably a C shell Script]</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/looking-for-a-modified-copy-command-prefrably-a-c-shell-script/m-p/4363353#M668306</link>
      <description>&lt;!--!*#--&gt;Hi:&lt;BR /&gt;&lt;BR /&gt;You really (already) have your solution -- write a wrapper script for 'cp'.  Do NOT use the C-shell.   It is dysfunctional.  See:&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://www.faqs.org/faqs/unix-faq/shell/csh-whynot/" target="_blank"&gt;http://www.faqs.org/faqs/unix-faq/shell/csh-whynot/&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;That said:&lt;BR /&gt;&lt;BR /&gt;# cat ./mycp&lt;BR /&gt;#!/usr/bin/sh&lt;BR /&gt;FILE="$@"&lt;BR /&gt;ARCHIVE=/var/tmp&lt;BR /&gt;[ -z "${FILE}"    ] &amp;amp;&amp;amp; { echo "Usage: $0 file"; exit 1; }&lt;BR /&gt;[ -f "${FILE}"    ] || { echo "File expected" ; exit 1; }&lt;BR /&gt;[ -d "${ARCHIVE}" ] || { echo "Missing '${ARCHIVE}' directory"; exit 1; }&lt;BR /&gt;SUBDIR=${ARCHIVE}/$(dirname ${FILE})&lt;BR /&gt;mkdir -p ${SUBDIR}&lt;BR /&gt;cp -p ${FILE} ${SUBDIR}/$(basename ${FILE}).backup&lt;BR /&gt;exit&lt;BR /&gt;&lt;BR /&gt;...run as :&lt;BR /&gt;&lt;BR /&gt;# ./mycp full_path_to_file&lt;BR /&gt;&lt;BR /&gt;For example:&lt;BR /&gt;&lt;BR /&gt;# ./mycp /etc/hosts&lt;BR /&gt;&lt;BR /&gt;# ./mycp /etc/rc.config.d/netconf&lt;BR /&gt;&lt;BR /&gt;Modify the ARCHIVE=/var/tmp to your tastes.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Fri, 20 Feb 2009 20:35:20 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/looking-for-a-modified-copy-command-prefrably-a-c-shell-script/m-p/4363353#M668306</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2009-02-20T20:35:20Z</dc:date>
    </item>
    <item>
      <title>Re: Looking for a modified copy command [ Prefrably a C shell Script]</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/looking-for-a-modified-copy-command-prefrably-a-c-shell-script/m-p/4363354#M668307</link>
      <description>James&lt;BR /&gt;Thanks for your prompt reply. My objective is to have an "Archive" directory wherever the file is being backed up which I understand maybe a little complicated.&lt;BR /&gt;Howevery I am getting a syntax error as below.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;surya{root}50% ./mycp /etc/resolv.conf&lt;BR /&gt;./mycp: syntax error at line 7: `SUBDIR=${ARCHIVE}/$' unexpected&lt;BR /&gt;surya{root}51% &lt;BR /&gt;</description>
      <pubDate>Fri, 20 Feb 2009 21:51:40 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/looking-for-a-modified-copy-command-prefrably-a-c-shell-script/m-p/4363354#M668307</guid>
      <dc:creator>Shreeraj Karulkar</dc:creator>
      <dc:date>2009-02-20T21:51:40Z</dc:date>
    </item>
    <item>
      <title>Re: Looking for a modified copy command [ Prefrably a C shell Script]</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/looking-for-a-modified-copy-command-prefrably-a-c-shell-script/m-p/4363355#M668308</link>
      <description>Hi (again):&lt;BR /&gt;&lt;BR /&gt;Hmmm.  I copied-and-pasted from my posting here and can't seem to repeat your error.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Fri, 20 Feb 2009 21:57:23 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/looking-for-a-modified-copy-command-prefrably-a-c-shell-script/m-p/4363355#M668308</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2009-02-20T21:57:23Z</dc:date>
    </item>
  </channel>
</rss>

